You are here

public function UltimateCronQueueSettings::cronapi in Ultimate Cron 7.2

Implements hook_cronapi().

Overrides UltimateCronPlugin::cronapi

File

plugins/ultimate_cron/settings/queue.class.php, line 44
Queue settings for Ultimate Cron.

Class

UltimateCronQueueSettings
Queue settings plugin class.

Code

public function cronapi() {
  $items = array();
  if (!variable_get($this->key . '_enabled', TRUE)) {
    return $items;
  }

  // Grab the defined cron queues.
  $queues = self::get_queues();
  foreach ($queues as $name => $info) {
    if (!empty($info['skip on cron'])) {
      continue;
    }
    $items['queue_' . $name] = array(
      'title' => t('Queue: !name', array(
        '!name' => $name,
      )),
      'callback' => array(
        get_class($this),
        'worker_callback',
      ),
      'scheduler' => array(
        'simple' => array(
          'rules' => array(
            '* * * * *',
          ),
        ),
        'crontab' => array(
          'rules' => array(
            '* * * * *',
          ),
        ),
      ),
      'settings' => array(
        'queue' => array(
          'name' => $name,
          'worker callback' => $info['worker callback'],
        ),
      ),
      'tags' => array(
        'queue',
        'core',
        'killable',
      ),
      'module' => $info['module'],
    );
    if (isset($info['time'])) {
      $items['queue_' . $name]['settings']['queue']['time'] = $info['time'];
    }
  }
  return $items;
}