From cb179e6b6a3981c6ec0816b68454daf157e15d4b Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 1 Feb 2015 19:54:56 +0100 Subject: [PATCH] Fixed rebuild script for comment response ids --- .../rebuild_comments_com.woltlab.wcf_2.1.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/acp/rebuild_comments_com.woltlab.wcf_2.1.php b/wcfsetup/install/files/acp/rebuild_comments_com.woltlab.wcf_2.1.php index 0bb43e4d09..e434259181 100644 --- a/wcfsetup/install/files/acp/rebuild_comments_com.woltlab.wcf_2.1.php +++ b/wcfsetup/install/files/acp/rebuild_comments_com.woltlab.wcf_2.1.php @@ -40,12 +40,12 @@ if ($rebuildData['max']) { $statement = WCF::getDB()->prepareStatement($sql, $commentsPerRun, $offset); $statement->execute(array(3)); - $commentData = array(); + $commentIDs = array(); while ($row = $statement->fetchArray()) { - $commentData[$row['commentID']] = array(); + $commentIDs[] = $row['commentID']; } - if (empty($commentData)) { + if (empty($commentIDs)) { WCF::getSession()->unregister('__wcfUpdateRebuildComments'); } else { @@ -56,13 +56,15 @@ if ($rebuildData['max']) { ORDER BY time"; $statement = WCF::getDB()->prepareStatement($sql, 5); - foreach ($commentData as $commentID => &$responseIDs) { + $commentData = array(); + for ($i = 0, $length = count($commentIDs); $i < $length; $i++) { + $commentID = $commentIDs[$i]; + $commentData[$commentID] = array(); + $statement->execute(array($commentID)); while ($row = $statement->fetchArray()) { - $responseIDs[] = $row['responseID']; + $commentData[$commentID][] = $row['responseID']; } - - $responseIDs = serialize($responseIDs); } // set responseIDs per comment @@ -73,7 +75,7 @@ if ($rebuildData['max']) { WCF::getDB()->beginTransaction(); foreach ($commentData as $commentID => $responseIDs) { $statement->execute(array( - $responseIDs, + serialize($responseIDs), $commentID )); } -- 2.20.1