method shutdown documentation in bbn\Cron\Runner
function()
{
$data = $this->getData();
$pid = $this->getPidPath($data);
$file_content = @file_get_contents($pid);
// Write the error log if an error is present
if ($error = error_get_last()) {
//$this->output(X::_('Error'), $error);
$this->log([$data, $error]);
}
$ok = true;
if (ob_get_length()) {
$content = ob_end_flush();
$this->output(X::_('Content'), $content);
}
// We check if there is a problem with the PID file (it's only debug it shouldn't be necessary)
if ($file_content) {
$pid_content = explode('|', $file_content);
if ($pid_content[1] && ($pid_content[0] != BBN_PID)) {
$this->output(X::_('Different processes'), $pid_content[0] . '/' . BBN_PID);
$this->log(X::_('Different processes') . ': ' . $pid_content[0] . '/' . BBN_PID);
$ok = false;
}
}
if ($ok && isset($data['type'])) {
// Removing PID file
if (is_file($pid)) {
@unlink($pid);
}
// And relaunching the continuous tasks if we are in the poller...
if (
($data['type'] === 'poll')
) {
$this->cron->launchPoll();
}
else if ($data['type'] === 'cron') {
if (array_key_exists('id', $data) && bbn\Str::isUid($data['id'])) {
$this->cron->getManager()->finish($data['id']);
}
else {
$this->cron->launchTaskSystem();
}
}
//X::dump("FROM SHUTDOWN", $data);
// We output the ending time (as all output will be logged in the output file
//$this->output(X::_('Shutdown'), Date('H:i:s'));
}
}
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