From c7152e8624e79e41b0f62e1f711e51e8d19f5a3b Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 9 Jan 2013 22:09:21 +0100 Subject: [PATCH] Fixed cronjob execution Fixes #906 Fixes #910 --- wcfsetup/install/files/lib/data/cronjob/Cronjob.class.php | 5 ++++- .../files/lib/system/cronjob/CronjobScheduler.class.php | 6 ++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/data/cronjob/Cronjob.class.php b/wcfsetup/install/files/lib/data/cronjob/Cronjob.class.php index 0e151e4dd7..65ad448d7a 100644 --- a/wcfsetup/install/files/lib/data/cronjob/Cronjob.class.php +++ b/wcfsetup/install/files/lib/data/cronjob/Cronjob.class.php @@ -54,7 +54,10 @@ class Cronjob extends DatabaseObject { public function getNextExec($timeBase = null) { if ($timeBase === null) { if ($this->lastExec) { - $timeBase = $this->lastExec; + $timeBase = $this->lastExec + 120; + if ($timeBase < TIME_NOW) { + $timeBase = TIME_NOW + 120; + } } else { // first time setup diff --git a/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php b/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php index dd17649513..f7a8ba0767 100644 --- a/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php @@ -106,15 +106,13 @@ class CronjobScheduler extends SingletonFactory { FROM wcf".WCF_N."_cronjob cronjob WHERE (cronjob.nextExec <= ? OR cronjob.afterNextExec <= ?) AND cronjob.isDisabled = ? - AND cronjob.failCount < ? - AND cronjob.state = ?"; + AND cronjob.failCount < ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array( TIME_NOW, TIME_NOW, 0, - Cronjob::MAX_FAIL_COUNT, - Cronjob::READY + Cronjob::MAX_FAIL_COUNT )); while ($row = $statement->fetchArray()) { $cronjob = new Cronjob(null, $row); -- 2.20.1