summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol
diff options
context:
space:
mode:
authorSimon Rettberg2017-12-01 13:42:04 +0100
committerSimon Rettberg2017-12-01 13:42:04 +0100
commit5393703f6e1485ddff94a50f63bcdd216ab629f4 (patch)
treece2db7130302bd4fb78b170e1fbd75496a1b4510 /modules-available/rebootcontrol
parentMerge remote-tracking branch 'origin/permission-manager' into permission-manager (diff)
parent[roomplanner] Sort already placed machines to the bottom (diff)
downloadslx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.tar.gz
slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.tar.xz
slx-admin-5393703f6e1485ddff94a50f63bcdd216ab629f4.zip
Merge branch 'master' into permission-manager
Diffstat (limited to 'modules-available/rebootcontrol')
-rw-r--r--modules-available/rebootcontrol/inc/rebootqueries.inc.php10
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'] = '';
}