From: Alexander Ebert Date: Mon, 29 Jul 2013 17:03:05 +0000 (+0200) Subject: Preventing workers from counting the same objects over and over again X-Git-Tag: 2.0.0_Beta_6~18 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=436a7fe82fd7495bfb0be0a14ebf3c9c9f8a1291;p=GitHub%2FWoltLab%2FWCF.git Preventing workers from counting the same objects over and over again --- diff --git a/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php index 89e634b1a9..b6322d35f0 100644 --- a/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php @@ -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(); + } } /** diff --git a/wcfsetup/install/files/lib/system/worker/AbstractWorker.class.php b/wcfsetup/install/files/lib/system/worker/AbstractWorker.class.php index 0d21bc60ae..1c4305a2b5 100644 --- a/wcfsetup/install/files/lib/system/worker/AbstractWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/AbstractWorker.class.php @@ -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