Add bulk processing parameter for UserActivityPointHandler::removeEvents()
authorMatthias Schmidt <gravatronics@live.com>
Fri, 21 Jun 2019 17:10:54 +0000 (19:10 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 21 Jun 2019 17:10:54 +0000 (19:10 +0200)
wcfsetup/install/files/lib/system/user/activity/point/UserActivityPointHandler.class.php

index 474912e985477a64bd9c747eac874bd9173e38c1..f54850d372ce0f41a22bff32a7a1040ff58f63d5 100644 (file)
@@ -151,11 +151,12 @@ class UserActivityPointHandler extends SingletonFactory {
        /**
         * Removes activity point events.
         * 
-        * @param       string                  $objectType
-        * @param       integer[]               $userToItems
+        * @param       string          $objectType
+        * @param       integer[]       $userToItems
+        * @param       boolean         $isBulkProcessing
         * @throws      InvalidObjectTypeException
         */
-       public function removeEvents($objectType, array $userToItems) {
+       public function removeEvents($objectType, array $userToItems, $isBulkProcessing = false) {
                if (empty($userToItems)) return;
                
                // get and validate object type
@@ -180,9 +181,13 @@ class UserActivityPointHandler extends SingletonFactory {
                        ]);
                }
                
-               // update total activity points per user
-               $userIDs = array_keys($userToItems);
-               $this->updateUsers($userIDs);
+               // during bulk processing, users do not have to be updated because
+               // they can be updated via `UserRebuildDataWorker` afterwards
+               // which calls `updateUsers()` 
+               if (!$isBulkProcessing) {
+                       // update total activity points per user
+                       $this->updateUsers(array_keys($userToItems));
+               }
        }
        
        /**