diff options
author | Simon Rettberg | 2022-06-23 15:02:27 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-06-23 15:02:27 +0200 |
commit | 4b02e3190c8a50300872aff6996781526db84c80 (patch) | |
tree | 82e28af7280e16f650977ef22470cac4aa2216a1 /modules-available/statistics/inc | |
parent | [statistics] Filter bogus memory speed hints (diff) | |
download | slx-admin-4b02e3190c8a50300872aff6996781526db84c80.tar.gz slx-admin-4b02e3190c8a50300872aff6996781526db84c80.tar.xz slx-admin-4b02e3190c8a50300872aff6996781526db84c80.zip |
[statistics] Fix standby crash filter
Diffstat (limited to 'modules-available/statistics/inc')
-rw-r--r-- | modules-available/statistics/inc/statisticsfilter.inc.php | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/modules-available/statistics/inc/statisticsfilter.inc.php b/modules-available/statistics/inc/statisticsfilter.inc.php index a53ef4d1..d60de9e7 100644 --- a/modules-available/statistics/inc/statisticsfilter.inc.php +++ b/modules-available/statistics/inc/statisticsfilter.inc.php @@ -358,24 +358,28 @@ class EnumStatisticsFilter extends SimpleStatisticsFilter public function whereClause(string $operator, $argument, array &$args, array &$joins): string { - $keys = ArrayUtil::flattenByKey($this->values, 'key'); - if (is_array($argument)) { - $ok = true; - foreach ($argument as $e) { - if (!in_array($e, $keys)) { - $ok = false; + if ($this->validateArgument()) { + $keys = ArrayUtil::flattenByKey($this->values, 'key'); + if (is_array($argument)) { + $ok = true; + foreach ($argument as $e) { + if (!in_array($e, $keys)) { + $ok = false; + } } + } else { + $ok = in_array($argument, $keys); + } + if (!$ok) { + Message::addError('invalid-enum-item', $this->column, $argument); + return '0'; } - } else { - $ok = in_array($argument, $keys); - } - if (!$ok) { - Message::addError('invalid-enum-item', $this->column, $argument); - return '0'; } return parent::whereClause($operator, $argument, $args, $joins); } + protected function validateArgument(): bool { return true; } + } class StandbyCrashStatisticsFilter extends EnumStatisticsFilter @@ -397,6 +401,8 @@ class StandbyCrashStatisticsFilter extends EnumStatisticsFilter return parent::whereClause($operator, $argument, $args, $joins); } + protected function validateArgument(): bool { return false; } + } class DateStatisticsFilter extends StatisticsFilter |