From a96315a1037dee46289cc26f7396e8a7056826fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Wed, 15 Jan 2020 00:41:25 +0100 Subject: [PATCH] AlephNoteStatistics --- www/internals/alephnoteStatistics.php | 28 ++++++++++++++++++--------- www/internals/mikeschergitgraph.php | 2 +- www/internals/website.php | 22 ++++++++++++--------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/www/internals/alephnoteStatistics.php b/www/internals/alephnoteStatistics.php index fcf838c..6c59386 100644 --- a/www/internals/alephnoteStatistics.php +++ b/www/internals/alephnoteStatistics.php @@ -1,26 +1,36 @@ 0'); + $this->site = $site; + + $site->Database(); } - public static function getUserCountFromLastVersion() + public function getTotalUserCount() { - return Database::sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0 GROUP BY Version ORDER BY INET_ATON(Version) DESC LIMIT 1'); + return $this->site->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0'); } - public static function getActiveUserCount($days) + public function getUserCountFromLastVersion() { - return Database::sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0 AND LastChanged > NOW() - INTERVAL '.$days.' DAY'); + return $this->site->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0 GROUP BY Version ORDER BY INET_ATON(Version) DESC LIMIT 1'); } - public static function getAllActiveEntriesOrdered() + public function getActiveUserCount($days) { - return Database::sql_query_assoc('SELECT * FROM an_statslog WHERE NoteCount>0 ORDER BY LastChanged DESC'); + return $this->site->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0 AND LastChanged > NOW() - INTERVAL '.$days.' DAY'); + } + + public function getAllActiveEntriesOrdered() + { + return $this->site->Database()->sql_query_assoc('SELECT * FROM an_statslog WHERE NoteCount>0 ORDER BY LastChanged DESC'); } } \ No newline at end of file diff --git a/www/internals/mikeschergitgraph.php b/www/internals/mikeschergitgraph.php index baeef52..b34c87a 100644 --- a/www/internals/mikeschergitgraph.php +++ b/www/internals/mikeschergitgraph.php @@ -1,6 +1,6 @@ programs; } + public function AlephNoteStatistics() + { + if ($this->anstats === null) { require_once 'alephnoteStatistics.php'; $this->anstats = new AlephNoteStatistics(); } + return $this->anstats; + } + /** * @return bool */