2 namespace wcf\system\stat
;
6 * Abstract implementation of a stat handler.
9 * @copyright 2001-2014 WoltLab GmbH
10 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11 * @package com.woltlab.wcf
12 * @subpackage system.stat
13 * @category Community Framework
15 abstract class AbstractStatDailyHandler
implements IStatDailyHandler
{
17 * Counts the number of rows for a single day.
19 * @param integer $date
20 * @param string $tableName
21 * @param string $dateColumnName
24 protected function getCounter($date, $tableName, $dateColumnName) {
25 $sql = "SELECT COUNT(*) AS count
26 FROM " . $tableName . "
27 WHERE " . $dateColumnName . " BETWEEN ? AND ?";
28 $statement = WCF
::getDB()->prepareStatement($sql);
29 $statement->execute(array($date, $date +
86399));
30 return $statement->fetchColumn();
34 * Counts the total number of rows.
36 * @param integer $date
37 * @param string $tableName
38 * @param string $dateColumnName
41 protected function getTotal($date, $tableName, $dateColumnName) {
42 $sql = "SELECT COUNT(*) AS count
43 FROM " . $tableName . "
44 WHERE " . $dateColumnName . " < ?";
45 $statement = WCF
::getDB()->prepareStatement($sql);
46 $statement->execute(array($date +
86400));
47 return $statement->fetchColumn();
51 * @see \wcf\system\stat\IStatDailyHandler::getFormattedCounter()
53 public function getFormattedCounter($counter) {