From 9e20a3a775c4cb8100b345718af02a9e11109850 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 7 Feb 2024 15:04:52 +0100 Subject: Revert "[statistics_reporting] Consider all machines in DB" Revert these changes that would result in different results. We're still not entirely clear how to handle the case of missing machines vs. machines that just haven't been used for quite some time. So instead of changing this now and possibly again in the near future, leave it as is for now and then do something more clever in the near future. This reverts commit 5dd6473d2f78d74c005ed20fb2a968f9bcae6ade. --- modules-available/statistics_reporting/inc/queries.inc.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules-available/statistics_reporting/inc/queries.inc.php b/modules-available/statistics_reporting/inc/queries.inc.php index 6446a89b..bafe80bc 100644 --- a/modules-available/statistics_reporting/inc/queries.inc.php +++ b/modules-available/statistics_reporting/inc/queries.inc.php @@ -15,8 +15,7 @@ class Queries public static function getClientStatistics(int $from, int $to, int $lowerTimeBound = 0, int $upperTimeBound = 24): array { - #$fromCutoff = $from - 86400 * 30; - $fromCutoff = 0; + $fromCutoff = $from - 86400 * 30; $res = Database::simpleQuery("SELECT m.machineuuid, m.hostname, m.clientip, m.locationid, m.firstseen -- , m.lastboot, m.logintime, m.state FROM machine m WHERE firstseen <= $to AND lastseen > $fromCutoff"); // " WHERE lastseen >= :from", compact('from')); @@ -31,8 +30,7 @@ class Queries public static function getLocationStatistics(int $from, int $to, int $lowerTimeBound = 0, int $upperTimeBound = 24): array { - #$fromCutoff = $from - 86400 * 30; - $fromCutoff = 0; + $fromCutoff = $from - 86400 * 30; $res = Database::simpleQuery("SELECT m.machineuuid, m.hostname, m.clientip, m.locationid, m.firstseen -- , m.lastboot, m.logintime, m.state FROM machine m WHERE firstseen <= $to AND lastseen > $fromCutoff"); // " WHERE lastseen >= :from", compact('from')); @@ -64,8 +62,7 @@ class Queries public static function getOverallStatistics(int $from, int $to, $lowerTimeBound = 0, $upperTimeBound = 24) { - #$fromCutoff = $from - 86400 * 30; - $fromCutoff = 0; + $fromCutoff = $from - 86400 * 30; $res = Database::simpleQuery("SELECT m.machineuuid, m.hostname, m.clientip, m.locationid, m.firstseen -- , m.lastboot, m.logintime, m.state FROM machine m WHERE firstseen <= $to AND lastseen > $fromCutoff"); // " WHERE lastseen >= :from", compact('from')); -- cgit v1.2.3-55-g7522