You are here

class UltimateCronSimpleScheduler in Ultimate Cron 7.2

Simple scheduler.

Hierarchy

Expanded class hierarchy of UltimateCronSimpleScheduler

1 string reference to 'UltimateCronSimpleScheduler'
simple.inc in plugins/ultimate_cron/scheduler/simple.inc

File

plugins/ultimate_cron/scheduler/simple.class.php, line 10
Simple cron job scheduler for Ultimate Cron.

View source
class UltimateCronSimpleScheduler extends UltimateCronCrontabScheduler {
  public $default_rule = '*/15+@ * * * *';
  public $presets = array(
    '* * * * *' => 60,
    '*/15+@ * * * *' => 900,
    '*/30+@ * * * *' => 1800,
    '0+@ * * * *' => 3600,
    '0+@ */3 * * *' => 10800,
    '0+@ */6 * * *' => 21600,
    '0+@ */12 * * *' => 43200,
    '0+@ 0 * * *' => 86400,
    '0+@ 0 * * 0' => 604800,
  );
  public $catch_up = array(
    '* * * * *' => 600,
    '*/15+@ * * * *' => 900,
    '*/30+@ * * * *' => 1800,
    '0+@ * * * *' => 3600,
    '0+@ */3 * * *' => 10800,
    '0+@ */6 * * *' => 21600,
    '0+@ */12 * * *' => 43200,
    '0+@ 0 * * *' => 86400,
    '0+@ 0 * * 0' => 604800,
  );

  /**
   * Default settings.
   */
  public function defaultSettings() {
    return array(
      'rules' => array(
        $this->default_rule,
      ),
    ) + parent::defaultSettings();
  }

  /**
   * Get default settings.
   */
  public function getDefaultSettings($job = NULL) {
    $settings = parent::getDefaultSettings($job);
    $settings['catch_up'] = $this->catch_up[isset($settings['rules'][0]) ? $settings['rules'][0] : $this->default_rule];
    return $settings;
  }

  /**
   * Label for settings.
   */
  public function settingsLabel($name, $value) {
    switch ($name) {
      case 'rules':
        return isset($value[0]) ? format_interval($this->presets[$value[0]]) : $value;
    }
    return parent::settingsLabel($name, $value);
  }

  /**
   * Label for schedule.
   */
  public function formatLabel($job) {
    $settings = $job
      ->getSettings($this->type);
    return t('Every @interval', array(
      '@interval' => format_interval($this->presets[$settings['rules'][0]]),
    ));
  }

  /**
   * Settings form for the simple scheduler.
   */
  public function settingsForm(&$form, &$form_state, $job = NULL) {
    $elements =& $form['settings'][$this->type][$this->name];
    $values =& $form_state['values']['settings'][$this->type][$this->name];
    $rule = is_array($values['rules']) ? reset($values['rules']) : '';
    $intervals = drupal_map_assoc($this->presets, 'format_interval');
    $options = array_combine(array_keys($this->presets), $intervals);
    $elements['rules'] = array(
      '#type' => 'select',
      '#title' => t('Run cron every'),
      '#default_value' => $rule,
      '#description' => t('Select the interval you wish cron to run on.'),
      '#options' => $options,
      '#fallback' => TRUE,
      '#required' => TRUE,
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UltimateCronCrontabScheduler::formatLabelVerbose public function Label for schedule. Overrides UltimateCronPlugin::formatLabelVerbose
UltimateCronCrontabScheduler::getSkew protected function Get a "unique" skew for a job.
UltimateCronCrontabScheduler::isBehind public function Determine if job is behind schedule. Overrides UltimateCronScheduler::isBehind
UltimateCronCrontabScheduler::isScheduled public function Schedule handler. Overrides UltimateCronScheduler::isScheduled
UltimateCronCrontabScheduler::settingsFormSubmit public function Submit handler. Overrides UltimateCronPlugin::settingsFormSubmit
UltimateCronCrontabScheduler::shouldRun public static function Check crontab rules against times.
UltimateCronPlugin::$description public property
UltimateCronPlugin::$globalOptions public static property
UltimateCronPlugin::$instances public static property
UltimateCronPlugin::$multiple public static property 1
UltimateCronPlugin::$name public property
UltimateCronPlugin::$plugin public property
UltimateCronPlugin::$settings public property
UltimateCronPlugin::$title public property
UltimateCronPlugin::$weight public property 1
UltimateCronPlugin::build_operations_alter public function Allow plugins to alter the allowed operations for a job. 2
UltimateCronPlugin::cleanForm public function Clean form of empty fallback values.
UltimateCronPlugin::cronapi public function A hook_cronapi() for plugins. 1
UltimateCronPlugin::cron_alter public function A hook_cron_alter() for plugins. 3
UltimateCronPlugin::cron_post_invoke public function A hook_cron_post_invoke() for plugins.
UltimateCronPlugin::cron_post_launch public function A hook_cron_post_launch() for plugins.
UltimateCronPlugin::cron_post_run public function A hook_cron_post_run() for plugins.
UltimateCronPlugin::cron_post_schedule public function A hook_cron_post_schedule() for plugins. 1
UltimateCronPlugin::cron_pre_invoke public function A hook_cron_pre_invoke() for plugins.
UltimateCronPlugin::cron_pre_launch public function A hook_cron_pre_launch() for plugins.
UltimateCronPlugin::cron_pre_run public function A hook_cron_pre_run() for plugins.
UltimateCronPlugin::cron_pre_schedule public function A hook_cron_pre_schedule() for plugins. 2
UltimateCronPlugin::defaultSettingsForm public static function Default settings form. 1
UltimateCronPlugin::drupal_array_remove_nested_value public function Modified version drupal_array_get_nested_value().
UltimateCronPlugin::factory public static function Singleton factoryLogEntry.
UltimateCronPlugin::fallbackalize public function Process fallback form parameters.
UltimateCronPlugin::getGlobalOption public static function Get global plugin option.
UltimateCronPlugin::getGlobalOptions public static function Get all global plugin options.
UltimateCronPlugin::hook_cron_alter final public static function Invoke hook_cron_alter() on plugins.
UltimateCronPlugin::hook_cron_post_invoke final public static function Invoke hook_cron_post_invoke() on plugins.
UltimateCronPlugin::hook_cron_post_launch final public static function Invoke hook_cron_post_launch() on plugins.
UltimateCronPlugin::hook_cron_post_run final public static function Invoke hook_cron_post_run() on plugins.
UltimateCronPlugin::hook_cron_post_schedule final public static function Invoke hook_cron_post_schedule() on plugins.
UltimateCronPlugin::hook_cron_pre_invoke final public static function Invoke hook_cron_pre_invoke() on plugins.
UltimateCronPlugin::hook_cron_pre_launch final public static function Invoke hook_cron_pre_launch() on plugins.
UltimateCronPlugin::hook_cron_pre_run final public static function Invoke hook_cron_pre_run() on plugins.
UltimateCronPlugin::hook_cron_pre_schedule final public static function Invoke hook_cron_pre_schedule() on plugins.
UltimateCronPlugin::isValid public function Default plugin valid for all jobs. 2
UltimateCronPlugin::jobSettingsForm public static function Job settings form. 1
UltimateCronPlugin::jobSettingsFormSubmit public static function Job settings form submit handler. 1
UltimateCronPlugin::jobSettingsFormValidate public static function Job settings form validate handler. 1
UltimateCronPlugin::setGlobalOption public static function Set global plugin option.
UltimateCronPlugin::setSettings public function Save settings to db.
UltimateCronPlugin::settingsFormValidate public function Settings form validate handler. 1
UltimateCronPlugin::signal public function Signal page for plugins. 2
UltimateCronPlugin::unsetGlobalOption public static function Remove a global plugin option.
UltimateCronPlugin::unsetGlobalOptions public static function Remove all global plugin options.
UltimateCronPlugin::__construct public function Constructor. 1
UltimateCronSimpleScheduler::$catch_up public property
UltimateCronSimpleScheduler::$default_rule public property
UltimateCronSimpleScheduler::$presets public property
UltimateCronSimpleScheduler::defaultSettings public function Default settings. Overrides UltimateCronCrontabScheduler::defaultSettings
UltimateCronSimpleScheduler::formatLabel public function Label for schedule. Overrides UltimateCronCrontabScheduler::formatLabel
UltimateCronSimpleScheduler::getDefaultSettings public function Get default settings. Overrides UltimateCronPlugin::getDefaultSettings
UltimateCronSimpleScheduler::settingsForm public function Settings form for the simple scheduler. Overrides UltimateCronCrontabScheduler::settingsForm
UltimateCronSimpleScheduler::settingsLabel public function Label for settings. Overrides UltimateCronPlugin::settingsLabel