From 04650e3680abe8b7cab348b2a0a658917c1c78b0 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 12 Jul 2004 23:46:54 +0000 Subject: [PATCH] re-read job, in case it had been updated or even deleted in the method --- phpgwapi/inc/class.asyncservice.inc.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/phpgwapi/inc/class.asyncservice.inc.php b/phpgwapi/inc/class.asyncservice.inc.php index 8c9db9a657..43a712549e 100644 --- a/phpgwapi/inc/class.asyncservice.inc.php +++ b/phpgwapi/inc/class.asyncservice.inc.php @@ -435,14 +435,21 @@ $GLOBALS['phpgw']->translation->add_app($app); ExecMethod($job['method'],$job['data']); - - if ($job['next'] = $this->next_run($job['times'])) + + // re-read job, in case it had been updated or even deleted in the method + $updated = $this->read($id); + if ($updated && isset($updated[$id])) { - $this->write($job,True); - } - else // no further runs - { - $this->delete($job['id']); + $job = $updated[$id]; + + if ($job['next'] = $this->next_run($job['times'])) + { + $this->write($job,True); + } + else // no further runs + { + $this->delete($job['id']); + } } } }