From c2affca145984d46056f91c0f7730275907cca0a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 20 Jan 2017 12:19:27 +0100 Subject: [locationinfo] Take lastboot into account when calcing pc state --- modules-available/locationinfo/inc/locationinfo.inc.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'modules-available/locationinfo/inc/locationinfo.inc.php') 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; -- cgit v1.2.3-55-g7522