parent::readData();
// set default values
- $d = DateUtil::getDateTimeByTimestamp(1366416000); // @todo TIME_NOW
+ $d = DateUtil::getDateTimeByTimestamp(TIME_NOW);
$d->setTimezone(WCF::getUser()->getTimeZone());
$this->endDate = $d->format('Y-m-d');
$d->sub(new \DateInterval('P1M'));
WCF::getSession()->checkPermissions(array('admin.system.canViewLog'));
// validate start date
- if (empty($this->parameters['startDate']) || !preg_match('/^\d{4}\-\d{2}\-\d{2}$/')) {
+ if (empty($this->parameters['startDate']) || !preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $this->parameters['startDate'])) {
throw new UserInputException('startDate');
}
// validate end date
- if (empty($this->parameters['endDate']) || !preg_match('/^\d{4}\-\d{2}\-\d{2}$/')) {
+ if (empty($this->parameters['endDate']) || !preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $this->parameters['endDate'])) {
throw new UserInputException('endDate');
}
* @see \wcf\system\stat\IStatDailyHandler::getData()
*/
public function getData($date) {
- $sql = "SELECT SUM(filesize)
+ $sql = "SELECT CEIL(SUM(filesize) / 1000)
FROM wcf".WCF_N."_attachment
WHERE uploadTime BETWEEN ? AND ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($date, $date + 86399));
$counter = intval($statement->fetchColumn());
- $sql = "SELECT SUM(filesize)
+ $sql = "SELECT CEIL(SUM(filesize) / 1000)
FROM wcf".WCF_N."_attachment
WHERE uploadTime < ?";
$statement = WCF::getDB()->prepareStatement($sql);
* @see \wcf\system\stat\IStatDailyHandler::getFormattedCounter()
*/
public function getFormattedCounter($counter) {
- return round($counter / 1000000); // return mb
+ return round($counter / 1000, 2); // return mb
}
}
$sql = "SELECT COUNT(*)
FROM wcf".WCF_N."_like
WHERE time BETWEEN ? AND ?
- AND likeValue";
+ AND likeValue = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($date, $date + 86399, $this->likeValue));
$counter = intval($statement->fetchColumn());
$sql = "SELECT COUNT(*)
FROM wcf".WCF_N."_like
- WHERE time < ?";
+ WHERE time < ?
+ AND likeValue = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($date + 86400, $this->likeValue));
$total = intval($statement->fetchColumn());