3 namespace wcf\system\stat
;
5 use wcf\system\comment\CommentHandler
;
6 use wcf\system\database\util\PreparedStatementConditionBuilder
;
7 use wcf\system\exception\SystemException
;
11 * Abstract implementation of a comment stat handler.
13 * @author Matthias Schmidt
14 * @copyright 2001-2019 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
17 abstract class AbstractCommentStatDailyHandler
extends AbstractStatDailyHandler
20 * name of the comment object type
23 protected $objectType = '';
28 public function getData($date)
30 $objectTypeID = CommentHandler
::getInstance()->getObjectTypeID($this->objectType
);
31 if ($objectTypeID === null) {
32 throw new SystemException("Unknown comment object type '" . $this->objectType
. "'");
37 FROM wcf" . WCF_N
. "_comment
38 WHERE objectTypeID = ?
39 AND time BETWEEN ? AND ?
42 FROM wcf" . WCF_N
. "_comment_response comment_response
43 LEFT JOIN wcf" . WCF_N
. "_comment comment
44 ON comment.commentID = comment_response.commentID
45 WHERE comment.objectTypeID = ?
46 AND comment_response.time BETWEEN ? AND ?
48 $statement = WCF
::getDB()->prepareStatement($sql);
57 $counter = $statement->fetchSingleColumn();
61 FROM wcf" . WCF_N
. "_comment
62 WHERE objectTypeID = ?
66 FROM wcf" . WCF_N
. "_comment_response comment_response
67 LEFT JOIN wcf" . WCF_N
. "_comment comment
68 ON comment.commentID = comment_response.commentID
69 WHERE comment.objectTypeID = ?
70 AND comment_response.time < ?
72 $statement = WCF
::getDB()->prepareStatement($sql);
79 $total = $statement->fetchSingleColumn();
82 'counter' => $counter,
91 protected function addConditions(PreparedStatementConditionBuilder
$conditionBuilder)
93 throw new \
BadMethodCallException(__CLASS__
. " does not support addConditions().");