From: Marcel Werk Date: Wed, 7 Aug 2013 17:07:26 +0000 (+0200) Subject: Fixed like rebuild worker X-Git-Tag: 2.0.0_Beta_7~56 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=64d7f754142bf5b4732250ff2e0a86739f07ea2b;p=GitHub%2FWoltLab%2FWCF.git Fixed like rebuild worker --- diff --git a/wcfsetup/install/files/lib/system/worker/LikeRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/LikeRebuildDataWorker.class.php index 801aaccf94..a90ba60e1b 100644 --- a/wcfsetup/install/files/lib/system/worker/LikeRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/LikeRebuildDataWorker.class.php @@ -70,7 +70,8 @@ class LikeRebuildDataWorker extends AbstractRebuildDataWorker { $likeObjectData[$like->objectTypeID][$like->objectID] = array( 'likes' => 0, 'dislikes' => 0, - 'cumulativeLikes' => 0 + 'cumulativeLikes' => 0, + 'objectUserID' => $like->objectUserID ); } @@ -86,23 +87,24 @@ class LikeRebuildDataWorker extends AbstractRebuildDataWorker { // update activity points UserActivityPointHandler::getInstance()->fireEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $itemsToUser, false); - $sql = "UPDATE wcf".WCF_N."_like_object - SET likes = ?, - dislikes = ?, - cumulativeLikes = ? - WHERE objectTypeID = ? - AND objectID = ?"; + $sql = "INSERT INTO wcf".WCF_N."_like_object + (objectTypeID, objectID, objectUserID, likes, dislikes, cumulativeLikes) + VALUES (?, ?, ?, ?, ?, ?) + ON DUPLICATE KEY UPDATE likes = VALUES(likes), + dislikes = VALUES(dislikes), + cumulativeLikes = VALUES(cumulativeLikes)"; $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); foreach ($likeObjectData as $objectTypeID => $objects) { foreach ($objects as $objectID => $data) { $statement->execute(array( + $objectTypeID, + $objectID, + $data['objectUserID'], $data['likes'], $data['dislikes'], - $data['cumulativeLikes'], - $objectTypeID, - $objectID + $data['cumulativeLikes'] )); } }