Fixed moderation queues not reappearing if content is moderated again
authorAlexander Ebert <ebert@woltlab.com>
Wed, 31 Jul 2013 17:40:18 +0000 (19:40 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 31 Jul 2013 17:40:18 +0000 (19:40 +0200)
wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueManager.class.php

index 080998e33aec112d1a2f5ccc581c7f2e73ff417c..69b9260cb5ac0f468840126f8f0bcfcbd50ac29d 100644 (file)
@@ -74,7 +74,7 @@ abstract class AbstractModerationQueueManager extends SingletonFactory implement
         * @param       array           $additionalData
         */
        protected function addEntry($objectTypeID, $objectID, $containerID = 0, array $additionalData = array()) {
-               $sql = "SELECT  COUNT(*) AS count
+               $sql = "SELECT  queueID
                        FROM    wcf".WCF_N."_moderation_queue
                        WHERE   objectTypeID = ?
                                AND objectID = ?";
@@ -85,7 +85,7 @@ abstract class AbstractModerationQueueManager extends SingletonFactory implement
                ));
                $row = $statement->fetchArray();
                
-               if ($row['count'] == 0) {
+               if ($row === false) {
                        $objectAction = new ModerationQueueAction(array(), 'create', array(
                                'data' => array(
                                        'objectTypeID' => $objectTypeID,
@@ -97,9 +97,21 @@ abstract class AbstractModerationQueueManager extends SingletonFactory implement
                                )
                        ));
                        $objectAction->executeAction();
-                       
-                       ModerationQueueManager::getInstance()->resetModerationCount();
                }
+               else {
+                       $objectAction = new ModerationQueueAction(array($row['queueID']), 'update', array(
+                               'data' => array(
+                                       'status' => ModerationQueue::STATUS_OUTSTANDING,
+                                       'containerID' => $containerID,
+                                       'userID' => (WCF::getUser()->userID ?: null),
+                                       'time' => TIME_NOW,
+                                       'additionalData' => serialize($additionalData)
+                               )
+                       ));
+                       $objectAction->executeAction();
+               }
+               
+               ModerationQueueManager::getInstance()->resetModerationCount();
        }
        
        /**