Merge pull request #7191 from hregis/4.0_bug3
Fix: run_jobs return always an error !!
This commit is contained in:
commit
cd6a3afc77
@ -914,16 +914,16 @@ class Cronjob extends CommonObject
|
|||||||
// load classes
|
// load classes
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$ret=dol_include_once($this->classesname);
|
$ret=dol_include_once($this->classesname);
|
||||||
if ($ret===false || (! class_exists($this->objectname)))
|
if ($ret===false || (! class_exists($this->objectname)))
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans('CronCannotLoadClass',$this->classesname,$this->objectname);
|
$this->error=$langs->trans('CronCannotLoadClass',$this->classesname,$this->objectname);
|
||||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||||
$this->lastoutput = $this->error;
|
$this->lastoutput = $this->error;
|
||||||
$this->lastresult = -1;
|
$this->lastresult = -1;
|
||||||
$retval = $this->lastresult;
|
$retval = $this->lastresult;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// test if method exists
|
// test if method exists
|
||||||
@ -972,7 +972,7 @@ class Cronjob extends CommonObject
|
|||||||
$result = call_user_func_array(array($object, $this->methodename), $params_arr);
|
$result = call_user_func_array(array($object, $this->methodename), $params_arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result===false || $result != 0)
|
if ($result === false || (! is_bool($result) && $result != 0))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$object->error, LOG_ERR);
|
dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$object->error, LOG_ERR);
|
||||||
@ -1021,7 +1021,7 @@ class Cronjob extends CommonObject
|
|||||||
$result = call_user_func_array($this->methodename, $params_arr);
|
$result = call_user_func_array($this->methodename, $params_arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result === false || $result != 0)
|
if ($result === false || (! is_bool($result) && $result != 0))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
dol_syslog(get_class($this)."::run_jobs result=".$result, LOG_ERR);
|
dol_syslog(get_class($this)."::run_jobs result=".$result, LOG_ERR);
|
||||||
@ -1086,17 +1086,17 @@ class Cronjob extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update with result
|
// Update with result
|
||||||
if (is_array($output_arr) && count($output_arr)>0)
|
if (is_array($output_arr) && count($output_arr)>0)
|
||||||
{
|
{
|
||||||
foreach($output_arr as $val)
|
foreach($output_arr as $val)
|
||||||
{
|
{
|
||||||
$this->lastoutput.=$val."\n";
|
$this->lastoutput.=$val."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lastresult=$retval;
|
$this->lastresult=$retval;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
|
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::run_jobs now we update job to track it is finished (with success or error)");
|
dol_syslog(get_class($this)."::run_jobs now we update job to track it is finished (with success or error)");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user