You are here

public function CronRule::preProcessRule in Ultimate Cron 7.2

Same name and namespace in other branches
  1. 8 CronRule.class.php \CronRule::preProcessRule()
  2. 6 CronRule.class.php \CronRule::preProcessRule()
  3. 7 CronRule.class.php \CronRule::preProcessRule()

Pre process rule.

Parameters

array &$parts: Parts of rules to pre process.

1 call to CronRule::preProcessRule()
CronRule::getIntervals in ./CronRule.class.php
Generate regex rules.

File

./CronRule.class.php, line 155
This class parses cron rules and determines last execution time using least case integer comparison.

Class

CronRule
@file This class parses cron rules and determines last execution time using least case integer comparison.

Code

public function preProcessRule(&$parts) {

  // Allow JAN-DEC.
  $months = array(
    1 => 'jan',
    'feb',
    'mar',
    'apr',
    'may',
    'jun',
    'jul',
    'aug',
    'sep',
    'oct',
    'nov',
    'dec',
  );
  $parts[3] = strtr(strtolower($parts[3]), array_flip($months));

  // Allow SUN-SUN.
  $days = array(
    'sun',
    'mon',
    'tue',
    'wed',
    'thu',
    'fri',
    'sat',
  );
  $parts[4] = strtr(strtolower($parts[4]), array_flip($days));
  $parts[4] = str_replace('7', '0', $parts[4]);
  $i = 0;
  foreach (self::$ranges as $type => $range) {
    $part =& $parts[$i++];
    $max = implode('-', $range);
    $part = str_replace("*", $max, $part);
    $part = str_replace("@", $this->skew % ($range[1] + 1), $part);
  }
}