You are here

function ultimate_cron_settings_form in Ultimate Cron 6

Same name and namespace in other branches
  1. 8 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
Implementation of 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', 'ultimate_cron', 'handle_prefix') : '') . 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', 'ultimate_cron', 'simultaneous_connections') : '') . 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', 'ultimate_cron', 'rules') : '') . 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', 'ultimate_cron', 'cleanup_log') : '') . 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', 'ultimate_cron', 'catch_up') : '') . 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) . ')'),
  );
  if (module_exists('drupal_queue')) {
    $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', 'ultimate_cron', 'polling_latency') : '') . 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', 'ultimate_cron', 'queue_lease_time') : '') . 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', 'ultimate_cron', 'service_group') : '') . t('Service group to use for all jobs. See Background Process !url for managing service groups.', array(
      '!url' => l(t('settings'), 'admin/settings/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', 'ultimate_cron', 'poorman') : '') . t('Keep background process alive, checking for cron every minute.'),
  );
  $form = system_settings_form($form);

  // Add reclaim button and make sure all the buttons are show last.
  $form['buttons']['#weight'] = 1000;
  $form['buttons']['reclaim'] = array(
    '#value' => t("Reclaim position"),
    '#description' => t('Changes weight of module to the lowest possible.'),
    '#type' => 'submit',
    '#submit' => array(
      'ultimate_cron_reclaim_submit',
    ),
    '#disabled' => !ultimate_cron_uncronable_modules(),
  );
  return $form;
}