MDL-79186 task: fix evaluation of 'X/Y' cron field format.

The above syntax is defined as supported by the class, for example the
format '5/10' means:

"At every 10th <unit> from 5 through <max>."

It is analogous to '5-<max>/10'.
This commit is contained in:
Paul Holden
2023-09-11 09:22:21 +01:00
parent f1116b10f1
commit 962c23a4d5
2 changed files with 44 additions and 9 deletions
+5
View File
@@ -384,6 +384,11 @@ abstract class scheduled_task extends task_base {
return [];
}
if ($instep) {
// Normalise range property, account for "5/10".
$insteprange = $range[count($range) - 1];
if (!is_array($insteprange)) {
$range[count($range) - 1] = range($insteprange, $max);
}
for ($i = 0; $i < count($range[count($range) - 1]); $i++) {
if (($i) % $match != 0) {
$range[count($range) - 1][$i] = -1;