Preventing workers from counting the same objects over and over again
authorAlexander Ebert <ebert@woltlab.com>
Mon, 29 Jul 2013 17:03:05 +0000 (19:03 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 29 Jul 2013 17:03:05 +0000 (19:03 +0200)
wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php
wcfsetup/install/files/lib/system/worker/AbstractWorker.class.php

index 89e634b1a9ebb6fb0bc348cfd83c1e217895809d..b6322d35f0c6179b75340941c51f1af1da80ce5d 100644 (file)
@@ -56,7 +56,9 @@ abstract class AbstractRebuildDataWorker extends AbstractWorker implements IRebu
         * @see wcf\system\worker\IWorker::countObjects()
         */
        public function countObjects() {
-               $this->count = $this->objectList->countObjects();
+               if ($this->count === null) {
+                       $this->count = $this->objectList->countObjects();
+               }
        }
        
        /**
index 0d21bc60ae6b8ab2b260ffc3bb63599d2ba726a4..1c4305a2b59d7d9b0eac0a6d3e3629c3ddd75764 100644 (file)
@@ -16,7 +16,7 @@ abstract class AbstractWorker implements IWorker {
         * count of total actions (limited by $limit per loop)
         * @var integer
         */
-       protected $count = 0;
+       protected $count = null;
        
        /**
         * limit of actions per loop