From fbacc082a8e33a6658c76b284a03b223084d6c99 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 15 Apr 2020 18:42:36 +0200 Subject: [PATCH] Orphaned conversations were not deleted --- .../system/worker/ConversationRebuildDataWorker.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/files/lib/system/worker/ConversationRebuildDataWorker.class.php b/files/lib/system/worker/ConversationRebuildDataWorker.class.php index 3bc855a..de85c3f 100644 --- a/files/lib/system/worker/ConversationRebuildDataWorker.class.php +++ b/files/lib/system/worker/ConversationRebuildDataWorker.class.php @@ -91,8 +91,9 @@ class ConversationRebuildDataWorker extends AbstractRebuildDataWorker { $sql = "SELECT COUNT(*) AS participants FROM wcf".WCF_N."_conversation_to_user WHERE conversationID = ? + AND hideConversation <> ? AND participantID IS NOT NULL"; - $existingParticipantStatement = WCF::getDB()->prepareStatement($sql, 5); + $existingParticipantStatement = WCF::getDB()->prepareStatement($sql); $obsoleteConversations = []; foreach ($this->objectList as $conversation) { @@ -104,7 +105,7 @@ class ConversationRebuildDataWorker extends AbstractRebuildDataWorker { if (!$conversation->userID) $obsolete = true; } else { - $existingParticipantStatement->execute([$conversation->conversationID]); + $existingParticipantStatement->execute([$conversation->conversationID, Conversation::STATE_LEFT]); $row = $existingParticipantStatement->fetchSingleRow(); if (!$row['participants']) $obsolete = true; } -- 2.20.1