function _cronDecodeRule in Elysia Cron 7.2
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()
- 6 elysia_cron_scheduler_old.inc \_cronDecodeRule()
- 7 elysia_cron_scheduler_old.inc \_cronDecodeRule()
Helper function for _elysia_cron_next_run().
2 calls to _cronDecodeRule()
- _cronDecodeRuleMday in ./
elysia_cron_scheduler.inc - Helper function for _elysia_cron_next_run().
- _elysia_cron_next_run in ./
elysia_cron_scheduler.inc - Helper function for cron run schedule.
File
- ./
elysia_cron_scheduler.inc, line 140 - Schedules cron runs.
Code
function _cronDecodeRule($rule, $min, $max) {
if ($rule == '*') {
return array(
'n' => array(),
'd' => 0,
);
}
$result = array(
'n' => array(),
'd' => 0,
);
foreach (explode(',', $rule) as $token) {
if (preg_match('/^([0-9]+)-([0-9]+)$/', $token, $r)) {
$result['n'] = array_merge($result['n'], range($r[1], $r[2]));
}
elseif (preg_match('/^\\*\\/([0-9]+)$/', $token, $r)) {
$result['d'] = $r[1];
}
elseif (is_numeric($token)) {
$result['n'][] = $token;
}
}
sort($result['n']);
return $result;
}