From 436a7fe82fd7495bfb0be0a14ebf3c9c9f8a1291 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 29 Jul 2013 19:03:05 +0200 Subject: [PATCH] Preventing workers from counting the same objects over and over again --- .../lib/system/worker/AbstractRebuildDataWorker.class.php | 4 +++- .../install/files/lib/system/worker/AbstractWorker.class.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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 -- 2.20.1