1
0
www.mikescher.com/www/internals/alephnoteStatistics.php

34 lines
917 B
PHP
Raw Normal View History

2020-01-14 22:25:43 +01:00
<?php
2018-01-27 00:28:32 +01:00
2020-01-15 00:41:25 +01:00
require_once 'website.php';
2018-01-27 00:28:32 +01:00
class AlephNoteStatistics
{
2020-01-15 00:41:25 +01:00
/** @var Website */
private $site;
public function __construct(Website $site)
{
$this->site = $site;
}
public function getTotalUserCount()
2018-01-27 00:28:32 +01:00
{
2020-01-15 00:41:25 +01:00
return $this->site->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0');
2018-01-27 00:28:32 +01:00
}
2020-01-15 00:41:25 +01:00
public function getUserCountFromLastVersion()
2018-01-27 00:28:32 +01:00
{
2020-01-15 00:41:25 +01:00
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');
2018-01-27 00:28:32 +01:00
}
2020-01-15 00:41:25 +01:00
public function getActiveUserCount($days)
2018-01-27 00:28:32 +01:00
{
2020-01-15 00:41:25 +01:00
return $this->site->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0 AND LastChanged > NOW() - INTERVAL '.$days.' DAY');
2018-01-27 00:28:32 +01:00
}
2020-01-15 00:41:25 +01:00
public function getAllActiveEntriesOrdered()
2018-01-27 00:28:32 +01:00
{
2020-01-15 00:41:25 +01:00
return $this->site->Database()->sql_query_assoc('SELECT * FROM an_statslog WHERE NoteCount>0 ORDER BY LastChanged DESC');
2018-01-27 00:28:32 +01:00
}
}