diff --git a/file/lib/data/chat/room/ChatRoomEditor.class.php b/file/lib/data/chat/room/ChatRoomEditor.class.php index 8a1498a..2d9c407 100644 --- a/file/lib/data/chat/room/ChatRoomEditor.class.php +++ b/file/lib/data/chat/room/ChatRoomEditor.class.php @@ -30,6 +30,28 @@ public static function deleteAll(array $objectIDs = array()) { \wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID, $packageID); } + $sql = "SELECT + position + FROM + wcf".WCF_N."_chat_room + WHERE + roomID = ? + FOR UPDATE"; + $select = WCF::getDB()->prepareStatement($sql); + + $sql = "UPDATE + wcf".WCF_N."_chat_room + SET + position = position - 1 + WHERE + position > ?"; + $update = WCF::getDB()->prepareStatement($sql); + + foreach ($objectIDs as $objectID) { + $select->execute(array($objectID)); + $update->execute(array($select->fetchColumn())); + } + // The transaction is being committed in parent::deleteAll() // The beginTransaction() call in there is simply ignored. return parent::deleteAll($objectIDs);