aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Comments
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Comments')
-rw-r--r--lib/private/Comments/Manager.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index f21f9ec76b2..50b5fabc6a2 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -1650,14 +1650,18 @@ class Manager implements ICommentsManager {
/**
* @inheritDoc
*/
- public function deleteMessageExpiredAtObject(string $objectType, string $objectId): bool {
+ public function deleteCommentsExpiredAtObject(string $objectType, string $objectId = ''): bool {
$qb = $this->dbConn->getQueryBuilder();
- $affectedRows = $qb->delete('comments')
+ $qb->delete('comments')
->where($qb->expr()->lt('expire_date',
$qb->createNamedParameter($this->timeFactory->getDateTime(), IQueryBuilder::PARAM_DATE)))
- ->andWhere($qb->expr()->eq('object_type', $qb->createNamedParameter($objectType)))
- ->andWhere($qb->expr()->eq('object_id', $qb->createNamedParameter($objectId)))
- ->executeStatement();
+ ->andWhere($qb->expr()->eq('object_type', $qb->createNamedParameter($objectType)));
+
+ if ($objectId !== '') {
+ $qb->andWhere($qb->expr()->eq('object_id', $qb->createNamedParameter($objectId)));
+ }
+
+ $affectedRows = $qb->executeStatement();
$this->commentsCache = [];