From 05639c4c66ee783439bf06c261728d6752a63f09 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 11 May 2017 13:43:06 +0200 Subject: [rebootcontrol] Don't show clients that haven't been seen for more than 30 days --- modules-available/rebootcontrol/inc/rebootqueries.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules-available/rebootcontrol/inc') diff --git a/modules-available/rebootcontrol/inc/rebootqueries.inc.php b/modules-available/rebootcontrol/inc/rebootqueries.inc.php index 3b665e5b..8f65b756 100644 --- a/modules-available/rebootcontrol/inc/rebootqueries.inc.php +++ b/modules-available/rebootcontrol/inc/rebootqueries.inc.php @@ -5,10 +5,12 @@ class RebootQueries // Get Client+IP+CurrentVM+CurrentUser+Location to fill the table public static function getMachineTable($locationId) { + $queryArgs = array('cutoff' => strtotime('-30 days')); if ($locationId === 0) { $where = 'machine.locationid IS NULL'; } else { $where = 'machine.locationid = :locationid'; + $queryArgs['locationid'] = $locationId; } $leftJoin = ''; $sessionField = 'machine.currentsession'; @@ -23,7 +25,7 @@ class RebootQueries $sessionField, machine.currentuser, machine.locationid FROM machine $leftJoin - WHERE " . $where, array('locationid' => $locationId)); + WHERE $where AND machine.lastseen > :cutoff", $queryArgs); $ret = $res->fetchAll(PDO::FETCH_ASSOC); $NOW = time(); foreach ($ret as &$row) { -- cgit v1.2.3-55-g7522