function __cronDecodeRule in Elysia Cron 7
Same name and namespace in other branches
- 5.2 elysia_cron_scheduler.inc \__cronDecodeRule()
- 5 elysia_cron_scheduler.inc \__cronDecodeRule()
- 6.2 elysia_cron_scheduler.inc \__cronDecodeRule()
- 6 elysia_cron_scheduler.inc \__cronDecodeRule()
2 calls to __cronDecodeRule()
File
- ./
elysia_cron_scheduler.inc, line 107
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;
}