Fixed delete of watched objects
authorMarcel Werk <burntime@woltlab.com>
Thu, 15 Aug 2013 17:23:17 +0000 (19:23 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 15 Aug 2013 17:23:17 +0000 (19:23 +0200)
wcfsetup/install/files/lib/system/user/object/watch/UserObjectWatchHandler.class.php

index f52306b769192bf328871d7487318e36d395a38f..971d73c0123f43268032c896da8a200a1438bdad 100644 (file)
@@ -76,8 +76,9 @@ class UserObjectWatchHandler extends SingletonFactory {
         * 
         * @param       string          $objectType
         * @param       array<integer>  $objectIDs
+        * @param       array<integer>  $userIDs
         */
-       public function deleteObjects($objectType, array $objectIDs) {
+       public function deleteObjects($objectType, array $objectIDs, array $userIDs = array()) {
                // get object type id
                $objectTypeObj = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', $objectType);
                
@@ -85,6 +86,7 @@ class UserObjectWatchHandler extends SingletonFactory {
                $conditionsBuilder = new PreparedStatementConditionBuilder();
                $conditionsBuilder->add('objectTypeID = ?', array($objectTypeObj->objectTypeID));
                $conditionsBuilder->add('objectID IN (?)', array($objectIDs));
+               if (!empty($userIDs)) $conditionsBuilder->add('userID IN (?)', array($userIDs));
                
                $sql = "DELETE FROM     wcf".WCF_N."_user_object_watch
                        ".$conditionsBuilder;