mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Properly delete position when a room is deleted.
This commit is contained in:
parent
c1b2fe0dfd
commit
2cc70345ce
@ -30,6 +30,28 @@ public static function deleteAll(array $objectIDs = array()) {
|
|||||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID, $packageID);
|
\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 transaction is being committed in parent::deleteAll()
|
||||||
// The beginTransaction() call in there is simply ignored.
|
// The beginTransaction() call in there is simply ignored.
|
||||||
return parent::deleteAll($objectIDs);
|
return parent::deleteAll($objectIDs);
|
||||||
|
Loading…
Reference in New Issue
Block a user