From: Alexander Ebert Date: Sun, 1 Feb 2015 18:54:56 +0000 (+0100) Subject: Fixed rebuild script for comment response ids X-Git-Tag: 2.1.0_Beta_4~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cb179e6b6a3981c6ec0816b68454daf157e15d4b;p=GitHub%2FWoltLab%2FWCF.git Fixed rebuild script for comment response ids --- 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 )); }