function _cronDecodeRule in Elysia Cron 6
Same name and namespace in other branches
- 5.2 elysia_cron_scheduler_old.inc \_cronDecodeRule()
- 5 elysia_cron_scheduler_old.inc \_cronDecodeRule()
- 6.2 elysia_cron_scheduler_old.inc \_cronDecodeRule()
- 7.2 elysia_cron_scheduler.inc \_cronDecodeRule()
- 7 elysia_cron_scheduler_old.inc \_cronDecodeRule()
1 call to _cronDecodeRule()
File
- ./
elysia_cron_scheduler_old.inc, line 132
Code
function _cronDecodeRule($rule, $min, $max) {
if ($rule == '*') {
return range($min, $max);
}
$result = array();
foreach (explode(',', $rule) as $token) {
if (preg_match('/^([0-9]+)-([0-9]+)$/', $token, $r)) {
$result = array_merge($result, range($r[1], $r[2]));
}
elseif (preg_match('/^\\*\\/([0-9]+)$/', $token, $r)) {
for ($i = $min; $i <= $max; $i++) {
if ($i % $r[1] == 0) {
$result[] = $i;
}
}
}
elseif (is_numeric($token)) {
$result[] = $token;
}
}
return $result;
}