AlephNoteStatistics
This commit is contained in:
parent
099f5b368e
commit
a96315a103
@ -1,26 +1,36 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/database.php');
|
require_once 'website.php';
|
||||||
|
|
||||||
class AlephNoteStatistics
|
class AlephNoteStatistics
|
||||||
{
|
{
|
||||||
public static function getTotalUserCount()
|
/** @var Website */
|
||||||
|
private $site;
|
||||||
|
|
||||||
|
public function __construct(Website $site)
|
||||||
{
|
{
|
||||||
return Database::sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>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');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
require_once 'website.php';
|
||||||
require_once (__DIR__ . '/../extern/egg/ExtendedGitGraph2.php');
|
require_once (__DIR__ . '/../extern/egg/ExtendedGitGraph2.php');
|
||||||
|
|
||||||
class MikescherGitGraph
|
class MikescherGitGraph
|
||||||
|
@ -6,9 +6,6 @@ require_once 'pageframeoptions.php';
|
|||||||
|
|
||||||
require_once 'utils.php';
|
require_once 'utils.php';
|
||||||
|
|
||||||
require_once 'mikeschergitgraph.php';
|
|
||||||
require_once 'parsedowncustom.php';
|
|
||||||
|
|
||||||
class Website
|
class Website
|
||||||
{
|
{
|
||||||
/** @var Website */
|
/** @var Website */
|
||||||
@ -17,12 +14,13 @@ class Website
|
|||||||
/** @var array */
|
/** @var array */
|
||||||
public $config;
|
public $config;
|
||||||
|
|
||||||
/** @var Database|null */ private $database = null;
|
/** @var Database|null */ private $database = null;
|
||||||
/** @var AdventOfCode|null */ private $adventOfCode = null;
|
/** @var AdventOfCode|null */ private $adventOfCode = null;
|
||||||
/** @var Blog|null */ private $blog = null;
|
/** @var Blog|null */ private $blog = null;
|
||||||
/** @var Books|null */ private $books = null;
|
/** @var Books|null */ private $books = null;
|
||||||
/** @var Euler|null */ private $euler = null;
|
/** @var Euler|null */ private $euler = null;
|
||||||
/** @var Programs|null */ private $programs = null;
|
/** @var Programs|null */ private $programs = null;
|
||||||
|
/** @var AlephNoteStatistics|null */ private $anstats = null;
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
@ -196,6 +194,12 @@ class Website
|
|||||||
return $this->programs;
|
return $this->programs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function AlephNoteStatistics()
|
||||||
|
{
|
||||||
|
if ($this->anstats === null) { require_once 'alephnoteStatistics.php'; $this->anstats = new AlephNoteStatistics(); }
|
||||||
|
return $this->anstats;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user