function __cronDecodeRuleMday in Elysia Cron 5.2
Same name and namespace in other branches
- 5 elysia_cron_scheduler.inc \__cronDecodeRuleMday()
- 6.2 elysia_cron_scheduler.inc \__cronDecodeRuleMday()
- 6 elysia_cron_scheduler.inc \__cronDecodeRuleMday()
- 7 elysia_cron_scheduler.inc \__cronDecodeRuleMday()
1 call to __cronDecodeRuleMday()
File
- ./
elysia_cron_scheduler.inc, line 128
Code
function __cronDecodeRuleMday($rule, $month, $year) {
$range_from = 1;
$range_to = $month != 2 ? in_array($month, array(
4,
6,
9,
11,
)) ? 30 : 31 : ($year % 4 == 0 ? 29 : 28);
$r1 = __cronDecodeRule($rule[0], $range_from, $range_to);
$r2 = __cronDecodeRule($rule[1], $range_from, $range_to);
if ($r2['d']) {
for ($i = 0; $i < 7; $i++) {
if ($i % $r2['d'] == 0) {
$r2['n'][] = $i;
}
}
}
if ($r2['n']) {
$r2['n'] = array_unique($r2['n']);
$r1['n'] = array_merge($r1['n'], __cronMonDaysFromWeekDays($year, $month, $r2['n']), __cronMonDaysFromWeekDays($year, $month + 1, $r2['n'], $range_to));
}
return $r1;
}