summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/inc/statistics.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2019-01-24 12:17:07 +0100
committerSimon Rettberg2019-01-24 12:17:07 +0100
commitc124192e63bd8a48ed1e7caf9542dc52505dfd22 (patch)
treee43d3ceb7ba0b81e01d0924f384bc61578deeca7 /modules-available/statistics/inc/statistics.inc.php
parent[locationinfo] use set config language for panels (diff)
downloadslx-admin-c124192e63bd8a48ed1e7caf9542dc52505dfd22.tar.gz
slx-admin-c124192e63bd8a48ed1e7caf9542dc52505dfd22.tar.xz
slx-admin-c124192e63bd8a48ed1e7caf9542dc52505dfd22.zip
[statistics] Handling of standby state in statistics, log crashes
Or rather, not really crashes, but log whenever a client reports a poweron event without reporting a proper shutdown first. This isn't neccessarily a crash but could also be due to power loss, hard poweroff, or network failures.
Diffstat (limited to 'modules-available/statistics/inc/statistics.inc.php')
-rw-r--r--modules-available/statistics/inc/statistics.inc.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules-available/statistics/inc/statistics.inc.php b/modules-available/statistics/inc/statistics.inc.php
index 2500f16f..1f8a081a 100644
--- a/modules-available/statistics/inc/statistics.inc.php
+++ b/modules-available/statistics/inc/statistics.inc.php
@@ -70,4 +70,21 @@ class Statistics
return $list;
}
+ const SESSION_LENGTH = '~session-length';
+ const OFFLINE_LENGTH = '~offline-length';
+ const SUSPEND_LENGTH = '~suspend-length';
+
+ public static function logMachineState($uuid, $ip, $type, $start, $length, $username = '')
+ {
+ return Database::exec('INSERT INTO statistic (dateline, typeid, machineuuid, clientip, username, data)'
+ . " VALUES (:start, :type, :uuid, :clientip, :username, :length)", array(
+ 'start' => $start,
+ 'type' => $type,
+ 'uuid' => $uuid,
+ 'clientip' => $ip,
+ 'username' => $username,
+ 'length' => $length,
+ ));
+ }
+
}