From 2c2504037d89e4505e4df1232c56ad2a789c3ca8 Mon Sep 17 00:00:00 2001 From: Steffen Ritter Date: Tue, 17 Dec 2019 14:47:44 +0100 Subject: Revert "[statistics] Make several filters by date actually work" This reverts commit 303d633e8a6dddbeee236935b6b21d7f5c27c4dc. Was not included in 3.8 release --- modules-available/statistics/inc/filter.inc.php | 37 +------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) (limited to 'modules-available') diff --git a/modules-available/statistics/inc/filter.inc.php b/modules-available/statistics/inc/filter.inc.php index 8f61e44b..46de467b 100644 --- a/modules-available/statistics/inc/filter.inc.php +++ b/modules-available/statistics/inc/filter.inc.php @@ -106,14 +106,6 @@ class Filter $filters[] = new LocationFilter($operator, $rhs); } elseif ($lhs === 'subnet') { $filters[] = new SubnetFilter($operator, $rhs); - } elseif ($lhs === 'lastboot') { - $filters[] = new ByDateFilter($operator, $rhs, $lhs); - } elseif ($lhs === 'firstseen') { - $filters[] = new ByDateFilter($operator, $rhs, $lhs); - } elseif ($lhs === 'lastseen') { - $filters[] = new ByDateFilter($operator, $rhs, $lhs); - } elseif ($lhs === 'logintime') { - $filters[] = new ByDateFilter($operator, $rhs, $lhs); } else { if (array_key_exists($lhs, Page_Statistics::$columns) && Page_Statistics::$columns[$lhs]['column']) { $filters[] = new Filter($lhs, $operator, $rhs); @@ -168,6 +160,7 @@ class RuntimeFilter extends Filter public function whereClause(&$args, &$joins) { + global $SIZE_RAM; $upper = time() - (int)$this->argument * 3600; $lower = $upper - 3600; $common = "state IN ('OCCUPIED', 'IDLE', 'STANDBY') AND"; @@ -190,34 +183,6 @@ class RuntimeFilter extends Filter } } -class ByDateFilter extends Filter -{ - public function __construct($operator, $argument, $filter) - { - parent::__construct($filter, $operator, $argument); - } - - public function whereClause(&$args, &$joins) - { - if ($this->operator == '=') { - return " DATE(FROM_UNIXTIME($this->column)) = '$this->argument'"; - } elseif ($this->operator == '<') { - return " DATE(FROM_UNIXTIME($this->column)) < '$this->argument'"; - } elseif ($this->operator == '<=') { - return " DATE(FROM_UNIXTIME($this->column)) <= '$this->argument'"; - } elseif ($this->operator == '>') { - return " DATE(FROM_UNIXTIME($this->column)) > '$this->argument'"; - } elseif ($this->operator == '>=') { - return " DATE(FROM_UNIXTIME($this->column)) >= '$this->argument'"; - } elseif ($this->operator == '!=') { - return " DATE(FROM_UNIXTIME($this->column)) != '$this->argument'"; - } else { - error_log("unimplemented operator in ByDateFilter: $this->operator"); - return ' 1'; - } - } -} - class Id44Filter extends Filter { public function __construct($operator, $argument) -- cgit v1.2.3-55-g7522