summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol
diff options
context:
space:
mode:
authorSimon Rettberg2017-05-11 13:43:06 +0200
committerSimon Rettberg2017-05-11 13:43:06 +0200
commit05639c4c66ee783439bf06c261728d6752a63f09 (patch)
treeca01b0acecb54ef423abccef467a1fabc9018317 /modules-available/rebootcontrol
parentRemove debug logging (diff)
downloadslx-admin-05639c4c66ee783439bf06c261728d6752a63f09.tar.gz
slx-admin-05639c4c66ee783439bf06c261728d6752a63f09.tar.xz
slx-admin-05639c4c66ee783439bf06c261728d6752a63f09.zip
[rebootcontrol] Don't show clients that haven't been seen for more than 30 days
Diffstat (limited to 'modules-available/rebootcontrol')
-rw-r--r--modules-available/rebootcontrol/inc/rebootqueries.inc.php4
1 files changed, 3 insertions, 1 deletions
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) {