function background_process_settings_form in Background Process 7
Same name and namespace in other branches
- 8 background_process.admin.inc \background_process_settings_form()
- 6 background_process.admin.inc \background_process_settings_form()
- 7.2 background_process.admin.inc \background_process_settings_form()
FAPI definition for settings page.
1 string reference to 'background_process_settings_form'
- background_process_menu in ./
background_process.module - Implements hook_menu().
File
- ./
background_process.admin.inc, line 9
Code
function background_process_settings_form() {
$form = array();
$form['background_process_service_timeout'] = array(
'#type' => 'textfield',
'#title' => t('Service timeout'),
'#description' => t('Timeout for service call in seconds (0 = disabled)'),
'#default_value' => variable_get('background_process_service_timeout', BACKGROUND_PROCESS_SERVICE_TIMEOUT),
);
$form['background_process_connection_timeout'] = array(
'#type' => 'textfield',
'#title' => t('Connection timeout'),
'#description' => t('Timeout for connection in seconds'),
'#default_value' => variable_get('background_process_connection_timeout', BACKGROUND_PROCESS_CONNECTION_TIMEOUT),
);
$form['background_process_stream_timeout'] = array(
'#type' => 'textfield',
'#title' => t('Stream timeout'),
'#description' => t('Timeout for stream in seconds'),
'#default_value' => variable_get('background_process_stream_timeout', BACKGROUND_PROCESS_STREAM_TIMEOUT),
);
$form['background_process_redispatch_threshold'] = array(
'#type' => 'textfield',
'#title' => t('Redispatch threshold (for locked processes)'),
'#description' => t('Seconds to wait before redispatching processes that never started.'),
'#default_value' => variable_get('background_process_redispatch_threshold', BACKGROUND_PROCESS_REDISPATCH_THRESHOLD),
);
$form['background_process_cleanup_age'] = array(
'#type' => 'textfield',
'#title' => t('Cleanup age (for locked processes)'),
'#description' => t('Seconds to wait before unlocking processes that never started.'),
'#default_value' => variable_get('background_process_cleanup_age', BACKGROUND_PROCESS_CLEANUP_AGE),
);
$form['background_process_cleanup_age_running'] = array(
'#type' => 'textfield',
'#title' => t('Cleanup age (for running processes)'),
'#description' => t('Unlock processes that has been running for more than X seconds.'),
'#default_value' => variable_get('background_process_cleanup_age_running', BACKGROUND_PROCESS_CLEANUP_AGE_RUNNING),
);
$form['background_process_cleanup_age_queue'] = array(
'#type' => 'textfield',
'#title' => t('Cleanup age for queued jobs'),
'#description' => t('Unlock queued processes that have been more than X seconds to start.'),
'#default_value' => variable_get('background_process_cleanup_age_queue', BACKGROUND_PROCESS_CLEANUP_AGE_QUEUE),
);
$options = background_process_get_service_hosts();
foreach ($options as $key => &$value) {
$new = empty($value['description']) ? $key : $value['description'];
$base_url = empty($value['base_url']) ? $base_url : $value['base_url'];
$http_host = empty($value['http_host']) ? parse_url($base_url, PHP_URL_HOST) : $value['http_host'];
$new .= ' (' . $base_url . ' - ' . $http_host . ')';
$value = $new;
}
$form['background_process_default_service_host'] = array(
'#type' => 'select',
'#title' => t('Default service host'),
'#description' => t('The default service host to use'),
'#options' => $options,
'#default_value' => variable_get('background_process_default_service_host', 'default'),
);
$form['background_process_ssl_verification'] = array(
'#type' => 'checkbox',
'#title' => t('SSL verification'),
'#description' => t("Don't turn this off on production environments, as it will raise security issues"),
'#default_value' => variable_get('background_process_ssl_verification', TRUE),
);
$methods = module_invoke_all('service_group');
$options = background_process_get_service_groups();
foreach ($options as $key => &$value) {
$value = (empty($value['description']) ? $key : $value['description']) . ' (' . join(',', $value['hosts']) . ') : ' . $methods['methods'][$value['method']];
}
$form['background_process_default_service_group'] = array(
'#type' => 'select',
'#title' => t('Default service group'),
'#description' => t('The default service group to use.'),
'#options' => $options,
'#default_value' => variable_get('background_process_default_service_group', 'default'),
);
$form = system_settings_form($form);
// Add determine button and make sure all the buttons are shown last.
$form['buttons']['#weight'] = 1000;
$form['buttons']['determine'] = array(
'#value' => t("Determine default service host"),
'#description' => t('Tries to determine the default service host.'),
'#type' => 'submit',
'#submit' => array(
'background_process_settings_form_determine_submit',
),
);
return $form;
}