summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-11-08 17:45:23 +0100
committerSimon Rettberg2019-11-08 17:45:23 +0100
commitc225e1bc52ddb99df25e4ee7b2524a7c2692a43b (patch)
tree5b33153ee6459dfd9687ecaffa944bf1e4078171
parent[statistics] Fix filtering by prefixing columns with table name (diff)
downloadslx-admin-c225e1bc52ddb99df25e4ee7b2524a7c2692a43b.tar.gz
slx-admin-c225e1bc52ddb99df25e4ee7b2524a7c2692a43b.tar.xz
slx-admin-c225e1bc52ddb99df25e4ee7b2524a7c2692a43b.zip
[statistics] FIX STUFF
-rw-r--r--modules-available/statistics/pages/summary.inc.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/modules-available/statistics/pages/summary.inc.php b/modules-available/statistics/pages/summary.inc.php
index be41b231..bf150f3e 100644
--- a/modules-available/statistics/pages/summary.inc.php
+++ b/modules-available/statistics/pages/summary.inc.php
@@ -48,10 +48,10 @@ class SubPage
private static function showSummary($filterSet)
{
$filterSet->makeFragments($where, $join, $sort, $args);
- $known = Database::queryFirst("SELECT Count(*) AS val FROM machine $join WHERE $where", $args);
- $on = Database::queryFirst("SELECT Count(*) AS val FROM machine $join WHERE state IN ('IDLE', 'OCCUPIED') AND ($where)", $args);
- $used = Database::queryFirst("SELECT Count(*) AS val FROM machine $join WHERE state = 'OCCUPIED' AND ($where)", $args);
- $hdd = Database::queryFirst("SELECT Count(*) AS val FROM machine $join WHERE badsectors >= 10 AND ($where)", $args);
+ $known = Database::queryFirst("SELECT Count(*) AS val FROM machine m $join WHERE $where", $args);
+ $on = Database::queryFirst("SELECT Count(*) AS val FROM machine m $join WHERE state IN ('IDLE', 'OCCUPIED') AND ($where)", $args);
+ $used = Database::queryFirst("SELECT Count(*) AS val FROM machine m $join WHERE state = 'OCCUPIED' AND ($where)", $args);
+ $hdd = Database::queryFirst("SELECT Count(*) AS val FROM machine m $join WHERE badsectors >= 10 AND ($where)", $args);
if ($on['val'] != 0) {
$usedpercent = round($used['val'] / $on['val'] * 100);
} else {
@@ -102,7 +102,7 @@ class SubPage
private static function showSystemModels($filterSet)
{
$filterSet->makeFragments($where, $join, $sort, $args);
- $res = Database::simpleQuery('SELECT systemmodel, Round(AVG(realcores)) AS cores, Count(*) AS `count` FROM machine'
+ $res = Database::simpleQuery('SELECT systemmodel, Round(AVG(realcores)) AS cores, Count(*) AS `count` FROM machine m'
. " $join WHERE $where GROUP BY systemmodel ORDER BY `count` DESC, systemmodel ASC", $args);
$lines = array();
$json = array();
@@ -132,7 +132,7 @@ class SubPage
private static function showMemory($filterSet)
{
$filterSet->makeFragments($where, $join, $sort, $args);
- $res = Database::simpleQuery("SELECT mbram, Count(*) AS `count` FROM machine $join WHERE $where GROUP BY mbram", $args);
+ $res = Database::simpleQuery("SELECT mbram, Count(*) AS `count` FROM machine m $join WHERE $where GROUP BY mbram", $args);
$lines = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
$gb = (int)ceil($row['mbram'] / 1024);
@@ -178,7 +178,7 @@ class SubPage
{
$filterSet->makeFragments($where, $join, $sort, $args);
$colors = array('UNKNOWN' => '#666', 'UNSUPPORTED' => '#ea5', 'DISABLED' => '#e55', 'ENABLED' => '#6d6');
- $res = Database::simpleQuery("SELECT kvmstate, Count(*) AS `count` FROM machine $join WHERE $where GROUP BY kvmstate ORDER BY `count` DESC", $args);
+ $res = Database::simpleQuery("SELECT kvmstate, Count(*) AS `count` FROM machine m $join WHERE $where GROUP BY kvmstate ORDER BY `count` DESC", $args);
$lines = array();
$json = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
@@ -198,7 +198,7 @@ class SubPage
private static function showId44($filterSet)
{
$filterSet->makeFragments($where, $join, $sort, $args);
- $res = Database::simpleQuery("SELECT id44mb, Count(*) AS `count` FROM machine $join WHERE $where GROUP BY id44mb", $args);
+ $res = Database::simpleQuery("SELECT id44mb, Count(*) AS `count` FROM machine m $join WHERE $where GROUP BY id44mb", $args);
$lines = array();
$total = 0;
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
@@ -251,7 +251,7 @@ class SubPage
$filterSet->makeFragments($where, $join, $sort, $args);
$args['cutoff'] = ceil(time() / 3600) * 3600 - 86400 * 10;
- $res = Database::simpleQuery("SELECT machineuuid, clientip, hostname, firstseen, mbram, kvmstate, id44mb FROM machine $join"
+ $res = Database::simpleQuery("SELECT machineuuid, clientip, hostname, firstseen, mbram, kvmstate, id44mb FROM machine m $join"
. " WHERE firstseen > :cutoff AND $where ORDER BY firstseen DESC LIMIT 32", $args);
$rows = array();
$count = 0;