You are here

function ultimate_cron_settings_form in Ultimate Cron 8

Same name and namespace in other branches
  1. 6 ultimate_cron.admin.inc \ultimate_cron_settings_form()
  2. 7 ultimate_cron.admin.inc \ultimate_cron_settings_form()

Settings form.

1 string reference to 'ultimate_cron_settings_form'
ultimate_cron_menu in ./ultimate_cron.module
Implements hook_menu().

File

./ultimate_cron.admin.inc, line 18

Code

function ultimate_cron_settings_form() {
  $form = array();
  $advanced_help_enabled = module_exists('advanced_help');

  // General settings -----------------------------------
  $form['general'] = array(
    '#title' => t('General'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#tree' => FALSE,
  );
  $form['general']['ultimate_cron_handle_prefix'] = array(
    '#title' => t("Handle prefix"),
    '#type' => 'textfield',
    '#default_value' => variable_get('ultimate_cron_handle_prefix', ULTIMATE_CRON_HANDLE_PREFIX),
    '#description' => ($advanced_help_enabled ? theme('advanced_help_topic', array(
      'module' => 'ultimate_cron',
      'topic' => 'handle_prefix',
      'type' => 'icon',
    )) : '') . t('Handle prefix. Use with care. Changing this from the default value ("' . ULTIMATE_CRON_HANDLE_PREFIX . '"), might break compatibility with 3rd party modules. Also, make sure that no jobs are running when changing this.'),
  );
  $form['general']['ultimate_cron_simultaneous_connections'] = array(
    '#title' => t("Simultaneous connections"),
    '#type' => 'textfield',
    '#default_value' => variable_get('ultimate_cron_simultaneous_connections', ULTIMATE_CRON_SIMULTANEOUS_CONNECTIONS),
    '#description' => ($advanced_help_enabled ? theme('advanced_help_topic', array(
      'module' => 'ultimate_cron',
      'topic' => 'simultaneous_connections',
      'type' => 'icon',
    )) : '') . t('Maximum number of simultaneous connections'),
  );
  $form['general']['ultimate_cron_rule'] = array(
    '#title' => t("Default rule"),
    '#type' => 'textfield',
    '#default_value' => variable_get('ultimate_cron_rule', ULTIMATE_CRON_RULE),
    '#description' => ($advanced_help_enabled ? theme('advanced_help_topic', array(
      'module' => 'ultimate_cron',
      'topic' => 'rules',
      'type' => 'icon',
    )) : '') . t('Enter the default fallback rule'),
  );
  $form['general']['ultimate_cron_cleanup_log'] = array(
    '#title' => t("Clean up logs older than X seconds"),
    '#type' => 'textfield',
    '#default_value' => variable_get('ultimate_cron_cleanup_log', ULTIMATE_CRON_CLEANUP_LOG),
    '#description' => ($advanced_help_enabled ? theme('advanced_help_topic', array(
      'module' => 'ultimate_cron',
      'topic' => 'cleanup_log',
      'type' => 'icon',
    )) : '') . t('Enter maximum age, in seconds, for log entries'),
  );
  $form['general']['ultimate_cron_catch_up'] = array(
    '#title' => t('Default catch up'),
    '#type' => 'textfield',
    '#default_value' => variable_get('ultimate_cron_catch_up', ULTIMATE_CRON_CATCH_UP),
    '#description' => ($advanced_help_enabled ? theme('advanced_help_topic', array(
      'module' => 'ultimate_cron',
      'topic' => 'catch_up',
      'type' => 'icon',
    )) : '') . t('Time in seconds to catch up, if a job could not be run within its time frame. (blank = ' . variable_get('ultimate_cron_catch_up', ULTIMATE_CRON_CATCH_UP) . ')'),
  );
  $form['general']['ultimate_cron_queue_polling_latency'] = array(
    '#title' => t("Queue polling latency"),
    '#type' => 'textfield',
    '#default_value' => variable_get('ultimate_cron_queue_polling_latency', ULTIMATE_CRON_QUEUE_POLLING_LATENCY),
    '#description' => ($advanced_help_enabled ? theme('advanced_help_topic', array(
      'module' => 'ultimate_cron',
      'topic' => 'polling_latency',
      'type' => 'icon',
    )) : '') . t('Queue polling latency in miliseconds. Leave blank to disable continuous processing of queues.'),
  );
  $form['general']['ultimate_cron_queue_lease_time'] = array(
    '#title' => t('Queue lease time'),
    '#type' => 'textfield',
    '#default_value' => variable_get('ultimate_cron_queue_lease_time', ULTIMATE_CRON_QUEUE_LEASE_TIME),
    '#description' => ($advanced_help_enabled ? theme('advanced_help_topic', array(
      'module' => 'ultimate_cron',
      'topic' => 'queue_lease_time',
      'type' => 'icon',
    )) : '') . t('Time in seconds to keep lock on claimed item'),
  );
  $methods = module_invoke_all('service_group');
  $options = ultimate_cron_get_service_groups();
  foreach ($options as $key => &$value) {
    $value = (empty($value['description']) ? $key : $value['description']) . ' (' . join(',', $value['hosts']) . ') : ' . $methods['methods'][$value['method']];
  }
  $form['general']['ultimate_cron_service_group'] = array(
    '#type' => 'select',
    '#title' => t('Service group'),
    '#description' => ($advanced_help_enabled ? theme('advanced_help_topic', array(
      'module' => 'ultimate_cron',
      'topic' => 'service_group',
      'type' => 'icon',
    )) : '') . t('Service group to use for all jobs. See Background Process !url for managing service groups.', array(
      '!url' => l(t('settings'), 'admin/config/system/background-process'),
    )),
    '#options' => $options,
    '#default_value' => variable_get('ultimate_cron_service_group', ULTIMATE_CRON_SERVICE_GROUP),
  );
  $form['general']['ultimate_cron_poorman'] = array(
    '#title' => t("Poormans cron"),
    '#type' => 'checkbox',
    '#default_value' => variable_get('ultimate_cron_poorman', ULTIMATE_CRON_POORMAN),
    '#description' => ($advanced_help_enabled ? theme('advanced_help_topic', array(
      'module' => 'ultimate_cron',
      'topic' => 'poorman',
      'type' => 'icon',
    )) : '') . t('Keep background process alive, checking for cron every minute.'),
  );
  $form = system_settings_form($form);
  return $form;
}