method finish documentation in bbn\Cron\Manager
Writes in the given CRON row the duration and the new finished status.
function(string $id_cron, $res = '')
{
$res = false;
if ($cron = $this->getCron($id_cron)) {
if (!empty($cron['cfg']['frequency'])) {
$time = time();
$start = date('Y-m-d H:i:s', $time);
$next = $this->getNextDate($cron['cfg']['frequency'], strtotime($cron['next'] ?: $start));
}
$enable = false;
$err_mode = $this->db->getErrorMode();
$this->db->setErrorMode(Errors::E_CONTINUE);
if ($this->db->isTriggerEnabled()) {
$this->db->disableTrigger();
$enable = true;
}
if ($this->db->update(
$this->table, [
'next' => $next ?? null,
'pid' => null,
'active' => isset($next) ? 1 : 0
], [
'id' => $id_cron,
'pid' => getmypid()
]
)
) {
$res = true;
}
if ($err_mode !== Errors::E_CONTINUE) {
$this->db->setErrorMode($err_mode);
}
if ($enable) {
$this->db->enableTrigger();
}
}
return $res;
}
Writes in the given CRON row the duration and the new finished status. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions