From 12705d58a6b56cff1d4b597ad2a640d338e53f99 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 14 Sep 2010 09:43:07 +0000 Subject: [PATCH] reverting back to arbitrary job data AND adding other job parameters only if data is an array, it made to many problems requiring it to be an array --- phpgwapi/inc/class.asyncservice.inc.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.asyncservice.inc.php b/phpgwapi/inc/class.asyncservice.inc.php index a83ba74f61..43331db4c7 100644 --- a/phpgwapi/inc/class.asyncservice.inc.php +++ b/phpgwapi/inc/class.asyncservice.inc.php @@ -65,13 +65,13 @@ class asyncservice * eg. 'X' where id is the internal id of app and X might indicate the action. * @param string $method Method to be called via ExecMethod($method,$data). $method has the form * '..'. - * @param array $data=null This data is passed back when the method is called. EGroupware adds the - * rest of the job parameters like id, next (sheduled exec time), times, ... + * @param mixed $data=null This data is passed back when the method is called. If it is an array, + * EGroupware will add the rest of the job parameters like id, next (sheduled exec time), times, ... * @param int $account_id account_id, under which the methode should be called or False for the actual user * @param boolean $debug=false * @return boolean False if $id already exists, else True */ - function set_timer($times,$id,$method,array $data=null,$account_id=False,$debug=false) + function set_timer($times,$id,$method,$data=null,$account_id=False,$debug=false) { if (empty($id) || empty($method) || $this->read($id) || !($next = $this->next_run($times,$debug))) @@ -426,7 +426,11 @@ class asyncservice list($app) = strpos($job['method'],'::') !== false ? explode('_',$job['method']) : explode('.',$job['method']); translation::add_app($app); - ExecMethod($job['method'],(array)$job['data']+array_diff_key($job,array('data' => false))); + if (is_array($job['data'])) + { + $job['data'] += array_diff_key($job,array('data' => false)); + } + ExecMethod($job['method'],$job['data']); // re-read job, in case it had been updated or even deleted in the method $updated = $this->read($id);