From c99577dccbccd39725dc29aba19e7b7c84ec454c Mon Sep 17 00:00:00 2001 From: Richard Steinmetz Date: Mon, 9 Oct 2023 14:28:27 +0200 Subject: [PATCH] fix(retention): properly clean orphans Signed-off-by: Richard Steinmetz --- lib/Db/MessageRetentionMapper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Db/MessageRetentionMapper.php b/lib/Db/MessageRetentionMapper.php index 8008f0f603..80feebb062 100644 --- a/lib/Db/MessageRetentionMapper.php +++ b/lib/Db/MessageRetentionMapper.php @@ -85,7 +85,7 @@ public function deleteOrphans(): void { ); $selectQb = $this->db->getQueryBuilder(); - $selectQb->select('mr.id') + $selectQb->select('mr.id', 'mr.uid', 'mr.mailbox_id') ->from($this->getTableName(), 'mr') ->leftJoin('mr', 'mail_messages', 'm', $selectQb->expr()->andX( $selectQb->expr()->eq( @@ -102,8 +102,8 @@ public function deleteOrphans(): void { ->where($selectQb->expr()->isNull('m.id')); $cursor = $selectQb->executeQuery(); while ($row = $cursor->fetch()) { - $deleteQb->setParameter('mailbox_id', $row['m.mailbox_id'], IQueryBuilder::PARAM_INT); - $deleteQb->setParameter('uid', $row['m.uid'], IQueryBuilder::PARAM_INT); + $deleteQb->setParameter('mailbox_id', $row['mailbox_id'], IQueryBuilder::PARAM_INT); + $deleteQb->setParameter('uid', $row['uid'], IQueryBuilder::PARAM_INT); $deleteQb->executeStatement(); } $cursor->closeCursor();