From e5c81fa86e2eb0b1cd90f90b0c54811c09b5b8e6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 21 Mar 2011 13:18:53 +0000 Subject: [PATCH] * exceptions in async jobs no longer stop other jobs, but log the exception to Apache error_log --- phpgwapi/inc/class.asyncservice.inc.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/class.asyncservice.inc.php b/phpgwapi/inc/class.asyncservice.inc.php index 43331db4c7..5d3c2a7f84 100644 --- a/phpgwapi/inc/class.asyncservice.inc.php +++ b/phpgwapi/inc/class.asyncservice.inc.php @@ -31,7 +31,7 @@ class asyncservice var $debug = 0; /** * Line in crontab set by constructor with absolute path - * + * * @var string */ var $cronline = '/phpgwapi/cron/asyncservices.php default'; @@ -414,8 +414,7 @@ class asyncservice if ($lang != $GLOBALS['egw_info']['user']['preferences']['common']['lang']) { - unset($GLOBALS['lang']); - translation::add_app('common'); + translation::init(); } } else @@ -430,8 +429,15 @@ class asyncservice { $job['data'] += array_diff_key($job,array('data' => false)); } - ExecMethod($job['method'],$job['data']); - + try + { + ExecMethod($job['method'],$job['data']); + } + catch(Exception $e) + { + // log the exception to error_log, but continue running other async jobs + _egw_log_exception($e); + } // re-read job, in case it had been updated or even deleted in the method $updated = $this->read($id); if ($updated && isset($updated[$id]))