Fix deleting an empty list of objects
authorjoshuaruesweg <ruesweg@woltlab.com>
Sun, 14 Feb 2021 12:35:03 +0000 (13:35 +0100)
committerjoshuaruesweg <ruesweg@woltlab.com>
Sun, 14 Feb 2021 12:35:13 +0000 (13:35 +0100)
It can happen that content that was previously counted no longer exists and therefore fewer runs are required than initially assumed. This can happen if, for example, a user's posts and threads are deleted and the user has only written posts in his or her own threads (the posts are then deleted along with the threads). This may have led to errors before because an empty list of objects was passed.

wcfsetup/install/files/lib/system/worker/UserContentRemoveWorker.class.php

index db558754a32c189494e1f70bbd319bcd638452ab..a2ba81f9a1ddeff424188689b7f49438bad00949 100644 (file)
@@ -178,7 +178,9 @@ class UserContentRemoveWorker extends AbstractWorker {
                $objectList = $processor->getContentListForUser($this->user);
                $objectList->sqlLimit = $this->limit;
                $objectList->readObjectIDs();
-               $processor->deleteContent($objectList->objectIDs);
+               if (!empty($objectList->objectIDs)) {
+                       $processor->deleteContent($objectList->objectIDs);
+               }
                
                $this->data['provider'][$providerObjectType]['count'] -= $this->limit;