From cd55ead3e2810e209b726faca12fa749f6875d0f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sat, 16 Dec 2017 18:33:16 +0100 Subject: Fix A LOT of type problems, logic flaws, uninitialized variables etc. Most of them were found by phpstorm, so I put in some time and went through the list, fixing quite a bunch of them. --- modules-available/statistics_reporting/inc/queries.inc.php | 4 ++-- .../statistics_reporting/inc/remotereport.inc.php | 2 +- modules-available/statistics_reporting/page.inc.php | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'modules-available/statistics_reporting') diff --git a/modules-available/statistics_reporting/inc/queries.inc.php b/modules-available/statistics_reporting/inc/queries.inc.php index 1a125c9e..bd8eb72e 100644 --- a/modules-available/statistics_reporting/inc/queries.inc.php +++ b/modules-available/statistics_reporting/inc/queries.inc.php @@ -5,7 +5,7 @@ class Queries { // Client Data: Name, Time Online, Median Time Online, Time Offline, last start, last logout, Last Time Booted, Number of Sessions > 60Sec, Number of Sessions < 60Sec, name of location, id of location (anonymized), machine uuid (anonymized) - public static function getClientStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24, $excludeToday = false) { + public static function getClientStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24) { $notassigned = Dictionary::translate('notAssigned', true); Database::exec("SET SESSION group_concat_max_len = 1000000000"); $res = Database::simpleQuery("SELECT t2.name AS clientName, timeSum, medianSessionLength, offlineSum, IFNULL(lastStart, 0) as lastStart, IFNULL(lastLogout, 0) as lastLogout, longSessions, shortSessions, t2.locId, t2.locName, MD5(CONCAT(t2.locId, :salt)) AS locHash, MD5(CONCAT(t2.uuid, :salt)) AS clientHash FROM ( @@ -27,7 +27,7 @@ class Queries } // Location Data: Name, ID (anonymized), Time Online, Median Time Online, Time Offline, Number of Sessions > 60Sec, Number of Sessions < 60Sec - public static function getLocationStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24, $excludeToday = false) { + public static function getLocationStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24) { $notassigned = Dictionary::translate('notAssigned', true); Database::exec("SET SESSION group_concat_max_len = 1000000000"); $res = Database::simpleQuery("SELECT t2.locId, t2.locName, MD5(CONCAT(t2.locId, :salt)) AS locHash, timeSum, medianSessionLength, offlineSum, longSessions, shortSessions FROM ( diff --git a/modules-available/statistics_reporting/inc/remotereport.inc.php b/modules-available/statistics_reporting/inc/remotereport.inc.php index e94e9b93..98af8888 100644 --- a/modules-available/statistics_reporting/inc/remotereport.inc.php +++ b/modules-available/statistics_reporting/inc/remotereport.inc.php @@ -96,7 +96,7 @@ class RemoteReport return $result; } - private function getLocalHardware() + private static function getLocalHardware() { $cpuInfo = file_get_contents('/proc/cpuinfo'); $uptime = file_get_contents('/proc/uptime'); diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 5d586b6c..863715d4 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -8,7 +8,18 @@ class Page_Statistics_Reporting extends Page private $type; // "Constants" + /** + * @var int + */ private $days; + /** + * @var int + */ + private $lower; + /** + * @var int + */ + private $upper; /** * @var array Names of columns that are being used by the various tables @@ -306,6 +317,7 @@ class Page_Statistics_Reporting extends Page case 'vm': return GetData::perVM($flags); } + return false; } } -- cgit v1.2.3-55-g7522