mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Just set the status of the cronjob if the job was run or was disabled.
This commit is contained in:
@@ -75,6 +75,7 @@ class cron extends CI_Controller {
|
||||
$cronjob = $this->cronexpression;
|
||||
$dt = new DateTime();
|
||||
$isdue = $cronjob->isMatching($dt);
|
||||
$set_status = false;
|
||||
|
||||
$next_run = $cronjob->getNext();
|
||||
$next_run_date = date('Y-m-d H:i:s', $next_run);
|
||||
@@ -108,6 +109,7 @@ class cron extends CI_Controller {
|
||||
echo "ERROR: Something went wrong with " . $cron->id . "; Message: " . $crun . "\n";
|
||||
$status = 'failed';
|
||||
}
|
||||
$set_status = true;
|
||||
} else {
|
||||
$isdue_result = 'false';
|
||||
echo "CRON: " . $cron->id . " -> is due: " . $isdue_result . " -> Next Run: " . $next_run_date . "\n";
|
||||
@@ -116,11 +118,14 @@ class cron extends CI_Controller {
|
||||
} else {
|
||||
echo 'CRON: ' . $cron->id . " is disabled. skipped..\n";
|
||||
$status = 'disabled';
|
||||
$set_status = true;
|
||||
|
||||
// Set the next_run timestamp to null to indicate in the view/database that this cron is disabled
|
||||
$this->cron_model->set_next_run($cron->id, null);
|
||||
}
|
||||
$this->cron_model->set_status($cron->id, $status);
|
||||
if ($set_status == true) {
|
||||
$this->cron_model->set_status($cron->id, $status);
|
||||
}
|
||||
$this->cronexpression = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user