diff options
author | Simon Rettberg | 2019-01-21 14:50:48 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-01-21 14:50:48 +0100 |
commit | 452bd74b291e63bcb0d84b118633e2a26852191c (patch) | |
tree | 92066af66505f29fcc4a49201d23a98663c4f789 /modules-available/statistics/api.inc.php | |
parent | [serversetup-bwlp] Fix saving default; add missing lang tag (diff) | |
parent | [statistics] Log if client seems to have crashed (diff) | |
download | slx-admin-452bd74b291e63bcb0d84b118633e2a26852191c.tar.gz slx-admin-452bd74b291e63bcb0d84b118633e2a26852191c.tar.xz slx-admin-452bd74b291e63bcb0d84b118633e2a26852191c.zip |
Merge branch 'master' into ipxe
Diffstat (limited to 'modules-available/statistics/api.inc.php')
-rw-r--r-- | modules-available/statistics/api.inc.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules-available/statistics/api.inc.php b/modules-available/statistics/api.inc.php index 8f5e9fd0..674cc48d 100644 --- a/modules-available/statistics/api.inc.php +++ b/modules-available/statistics/api.inc.php @@ -161,6 +161,11 @@ if ($type{0} === '~') { // Check for suspicious hardware changes if ($old !== false) { checkHardwareChange($old, $new); + + // Log potential crash + if ($old['state'] === 'IDLE' || $old['state'] === 'OCCUPIED') { + writeClientLog('machine-mismatch-poweron', 'Client sent poweron event, but previous known state is ' . $old['state']); + } } // Write statistics data @@ -403,6 +408,18 @@ function writeStatisticLog($type, $username, $data) )); } +function writeClientLog($type, $description) +{ + global $ip, $uuid; + Database::exec('INSERT INTO clientlog (dateline, logtypeid, clientip, machineuuid, description, extra) VALUES (UNIX_TIMESTAMP(), :type, :client, :uuid, :description, :longdesc)', array( + 'type' => $type, + 'client' => $ip, + 'description' => $description, + 'longdesc' => '', + 'uuid' => $uuid, + )); +} + // For backwards compat, we require the . prefix if ($type{0} === '.') { |