diff options
author | Simon Rettberg | 2017-01-20 12:19:27 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-01-20 12:19:27 +0100 |
commit | c2affca145984d46056f91c0f7730275907cca0a (patch) | |
tree | 659fb2d1c41199601128044a19b84d3887453f2c /modules-available/locationinfo/inc | |
parent | Deleted the pcsubtable. Bugs/Usability fixes. (diff) | |
download | slx-admin-c2affca145984d46056f91c0f7730275907cca0a.tar.gz slx-admin-c2affca145984d46056f91c0f7730275907cca0a.tar.xz slx-admin-c2affca145984d46056f91c0f7730275907cca0a.zip |
[locationinfo] Take lastboot into account when calcing pc state
Diffstat (limited to 'modules-available/locationinfo/inc')
-rw-r--r-- | modules-available/locationinfo/inc/locationinfo.inc.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php index f81d79f6..d4bd2b0a 100644 --- a/modules-available/locationinfo/inc/locationinfo.inc.php +++ b/modules-available/locationinfo/inc/locationinfo.inc.php @@ -3,7 +3,7 @@ class LocationInfo { - public static function getPcState($logintime, $lastseen) + public static function getPcState($pc) { /* pcState: * [0] = IDLE (NOT IN USE) @@ -12,13 +12,16 @@ class LocationInfo * [3] = 10 days offline (BROKEN?) */ + $logintime = (int)$pc['logintime']; + $lastseen = (int)$pc['lastseen']; + $lastboot = (int)$pc['lastboot']; $NOW = time(); - if ($NOW - $lastseen > 864000) { + if ($NOW - $lastseen > 14*86400) { return 3; - } elseif ($NOW - $lastseen > 610) { + } elseif (($NOW - $lastseen > 610) || $lastboot === 0) { return 2; - } elseif ($logintime == 0) { + } elseif ($logintime === 0) { return 0; } elseif ($logintime > 0) { return 1; |