diff options
author | Simon Rettberg | 2017-11-28 16:41:33 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-11-28 16:41:33 +0100 |
commit | 23d8c6fc0c3b031aa081ee1a245f9b0792514fd3 (patch) | |
tree | 59ce05e8add76d7b63213a0fa447a42565ea2e3d /modules-available/rebootcontrol | |
parent | [dnbd3] Disable SLX_SYSTEM_STANDBY_TIMEOUT (diff) | |
download | slx-admin-23d8c6fc0c3b031aa081ee1a245f9b0792514fd3.tar.gz slx-admin-23d8c6fc0c3b031aa081ee1a245f9b0792514fd3.tar.xz slx-admin-23d8c6fc0c3b031aa081ee1a245f9b0792514fd3.zip |
[statistics] Introduce state column to get rid of complicated state determination
This also adds support for the STANDBY state
Diffstat (limited to 'modules-available/rebootcontrol')
-rw-r--r-- | modules-available/rebootcontrol/inc/rebootqueries.inc.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules-available/rebootcontrol/inc/rebootqueries.inc.php b/modules-available/rebootcontrol/inc/rebootqueries.inc.php index 8f65b756..1bdcb9a2 100644 --- a/modules-available/rebootcontrol/inc/rebootqueries.inc.php +++ b/modules-available/rebootcontrol/inc/rebootqueries.inc.php @@ -21,7 +21,7 @@ class RebootQueries } $res = Database::simpleQuery(" SELECT machine.machineuuid, machine.hostname, machine.clientip, - machine.lastboot, machine.lastseen, machine.logintime, + machine.lastboot, machine.lastseen, machine.logintime, machine.state, $sessionField, machine.currentuser, machine.locationid FROM machine $leftJoin @@ -29,12 +29,12 @@ class RebootQueries $ret = $res->fetchAll(PDO::FETCH_ASSOC); $NOW = time(); foreach ($ret as &$row) { - if ($row['lastboot'] == 0 || $NOW - $row['lastseen'] > 600) { - $row['status'] = 0; - } else { + if ($row['state'] === 'IDLE' || $row['state'] === 'OCCUPIED') { $row['status'] = 1; + } else { + $row['status'] = 0; } - if ($row['status'] === 0 || $row['logintime'] == 0) { + if ($row['state'] !== 'OCCUPIED') { $row['currentuser'] = ''; $row['currentsession'] = ''; } |