Fix update run date
This commit is contained in:
parent
ed690885d3
commit
9476a346b8
@ -862,8 +862,6 @@ class Cronjob extends CommonObject
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($this->jobtype=='method') {
|
||||
// load classes
|
||||
$ret=dol_include_once("/".$this->module_name."/class/".$this->classesname,$this->objectname);
|
||||
@ -885,6 +883,15 @@ class Cronjob extends CommonObject
|
||||
// Create Object for the call module
|
||||
$object = new $this->objectname($this->db);
|
||||
|
||||
//Update launch start date
|
||||
$this->datelastrun=$now;
|
||||
$this->nbrun=$this->nbrun+1;
|
||||
$result = $this->update($user);
|
||||
if ($result<0) {
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$params_arr = array();
|
||||
$params_arr=explode(", ",$this->params);
|
||||
if (!is_array($params_arr)) {
|
||||
@ -905,6 +912,15 @@ class Cronjob extends CommonObject
|
||||
dol_syslog(get_class($this)."::run_jobs system:".$this->command, LOG_DEBUG);
|
||||
$output_arr=array();
|
||||
|
||||
//Update launch start date
|
||||
$this->datelastrun=$now;
|
||||
$this->nbrun=$this->nbrun+1;
|
||||
$result = $this->update($user);
|
||||
if ($result<0) {
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
exec($this->command, $output_arr,$retval);
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG);
|
||||
@ -918,16 +934,13 @@ class Cronjob extends CommonObject
|
||||
$this->lastresult=$retval;
|
||||
}
|
||||
|
||||
//Update result date
|
||||
$this->datelastresult=$now;
|
||||
$this->datelastrun=$now;
|
||||
$this->nbrun=$this->nbrun+1;
|
||||
$result = $this->update($user);
|
||||
if ($result<0) {
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user