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:17 +01:00
parent b4c6ed3650
commit 75c36558b6
2 changed files with 43 additions and 9 deletions
+5
View File
@@ -431,6 +431,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;