Skip to content

Commit

Permalink
fix(retention): properly clean orphans
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Steinmetz <[email protected]>
  • Loading branch information
st3iny committed Oct 9, 2023
1 parent fef0d04 commit c99577d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Db/MessageRetentionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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();
Expand Down

0 comments on commit c99577d

Please sign in to comment.