You are here

public function CronRule::preProcessRule in Ultimate Cron 8.2

Pre process rule.

Parameters

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

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

File

src/CronRule.php, line 154

Class

CronRule

Namespace

Drupal\ultimate_cron

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);
  }
}