Commit 9c32e324 authored by Brett Wilkins's avatar Brett Wilkins Committed by Richard Mansfield
Browse files

lib/cron: Adding line to signify cron finishing

Will also show finishing time relative to fake cron time, if the feature is used.
parent fba71e3c
...@@ -60,11 +60,12 @@ if (!$maxrunage = get_config('maxrunage')) { ...@@ -60,11 +60,12 @@ if (!$maxrunage = get_config('maxrunage')) {
// This is here for debugging purposes, it allows us to fake the time to test // This is here for debugging purposes, it allows us to fake the time to test
// cron behaviour // cron behaviour
$time = time();
if(isset($argv[1])) { if(isset($argv[1])) {
$now = strtotime($argv[1]); $now = strtotime($argv[1]);
} }
else { else {
$now = time(); $now = $time;
} }
log_debug('---------- cron running ' . date('r', $now) . ' ----------'); log_debug('---------- cron running ' . date('r', $now) . ' ----------');
...@@ -178,6 +179,14 @@ if ($jobs = get_records_select_array('cron', 'nextrun < ? OR nextrun IS NULL', ...@@ -178,6 +179,14 @@ if ($jobs = get_records_select_array('cron', 'nextrun < ? OR nextrun IS NULL',
} }
} }
$finish = time();
//Time relative to fake cron time
if (isset($argv[1])) {
$diff = $time - $now;
$finish = $finish - $diff;
}
log_debug('---------- cron finished ' . date('r', $finish) . ' ----------');
function cron_next_run_time($lastrun, $job) { function cron_next_run_time($lastrun, $job) {
$run_date = getdate($lastrun); $run_date = getdate($lastrun);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment