function replication_admin in Replication 5
Same name and namespace in other branches
- 5.0 replication.module \replication_admin()
1 string reference to 'replication_admin'
File
- ./
replication.module, line 47
Code
function replication_admin() {
$options = array();
$i = 0;
$themes = system_theme_data();
foreach ($themes as $key => $values) {
$options[$key] = $key;
$i++;
}
//general replication settings
$form['replication'] = array(
'#type' => 'fieldset',
'#title' => t('General Settings'),
'#weight' => 0,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
//define whether we are:
//0 - free-standing (no replication takes place)
//1 - the master server
//2 - a slave server
//NOTE that if the replication module has not been installed then any application testing this
//variable should assume the default 0 - that the server is not part of replication
//note also that if a server is being used as a 'distributor' its setting should be as a slave
//since writes will still be made to the overall master server
$form['replication']['replication_server_mode'] = array(
'#type' => 'select',
'#title' => 'Server mode',
'#required' => 'TRUE',
'#options' => array(
'0' => 'Single server',
'1' => 'Master mode',
'2' => 'Replication slave',
),
'#default_value' => variable_get('replication_server_mode', '0'),
'#description' => t('If you are not running a multi-server system, you should leave this set to "Single Server" mode'),
);
$form['replication']['replication_admin_identifier'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('replication_admin_identifier', ''),
'#title' => t('Slave Server identifier'),
'#maxlength' => '10',
'#size' => '10',
'#description' => t("Enter a unique server identifier - e.g 'slaveid001'"),
);
$form['replication']['replication_admin_max_recheck'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('replication_admin_max_recheck', '10'),
'#title' => t('Maximum re-tests'),
'#required' => 'TRUE',
'#maxlength' => '2',
'#size' => '2',
'#description' => t("To test connectivity with the master server a slave writes data to the master then reads locally. Enter a value for the maximum number of times the slave will repeat this test during a replication check."),
);
$form['replication']['replication_admin_wait_recheck'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('replication_admin_wait_recheck', '1'),
'#title' => t('Re-test delay.'),
'#required' => 'TRUE',
'#maxlength' => '2',
'#size' => '2',
'#description' => t("Enter a value in seconds to wait before re-checking connectivity after a failed test. Note that a longer delay may cause cron to fail."),
);
//theme settings
$form['replication_theme'] = array(
'#type' => 'fieldset',
'#title' => t('Theme configuration'),
'#weight' => 0,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['replication_theme']['replication_admin_normal_theme'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => variable_get('replication_admin_normal_theme', 'garland'),
'#title' => t('Regular theme'),
'#required' => 'TRUE',
'#description' => t("The theme to be used when the mysql master is available."),
);
$form['replication_theme']['replication_admin_warning_theme'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => variable_get('replication_admin_warning_theme', 'garland'),
'#title' => t('Recovery theme'),
'#required' => 'TRUE',
'#description' => t("The theme to be used when the mysql master is unavailable."),
);
// extended configuration settings - for applications doing additional replication using http
$form['replication_http'] = array(
'#type' => 'fieldset',
'#title' => 'HTTP replication settings',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
//this should only be available if we're a slave, need some inline js to deal with it ZZZZZZZZZZZZ
$form['replication_http']['replication_server_url'] = array(
'#type' => 'textfield',
'#title' => 'Master URL',
'#maxlength' => 255,
'#default_value' => variable_get('replication_server_url', ''),
'#description' => t('If this node is a replication slave, you should specify the master server url here - including the leading http:// or https:// etc. Otherwise, leave this field blank. DO NOT include a trailing slash'),
);
$form['replication_http']['replication_http_port'] = array(
'#type' => 'textfield',
'#title' => 'Replication Port',
'#maxlength' => 5,
'#size' => 5,
'#default_value' => variable_get('replication_http_port', ''),
'#description' => t('By default the port used for http transfers is 80 for http and 443 for https. If you wish to use a different port you should specify it here. Otherwise, leave this field blank'),
);
$form['replication_http']['replication_http_connect'] = array(
'#type' => 'textfield',
'#title' => 'Replication connection timeout (in Seconds)',
'#maxlength' => 5,
'#size' => 5,
'#default_value' => variable_get('replication_http_connect', '5'),
'#description' => t('This is the time allowed to establish the http connection - Enter a value in seconds.'),
);
$form['replication_http']['replication_http_timeout'] = array(
'#type' => 'textfield',
'#title' => 'Replication timeout (Milliseconds per Kilobyte)',
'#maxlength' => 6,
'#size' => 6,
'#default_value' => variable_get('replication_http_timeout', '500'),
'#description' => t('This controls the MINIMUM data speed. Enter a value in milliseconds.'),
);
$form['replication_http']['replication_http_speedlimit'] = array(
'#type' => 'textfield',
'#title' => 'Maximum speed (Kilobits per second)',
'#maxlength' => 10,
'#size' => 10,
'#default_value' => variable_get('replication_http_speedlimit', '128'),
'#description' => t('Enter a value in kilobits.'),
);
$form['replication_http']['replication_http_retries'] = array(
'#type' => 'textfield',
'#title' => 'Maximum number of retries',
'#maxlength' => 3,
'#size' => 3,
'#default_value' => variable_get('replication_http_retries', '5'),
'#description' => t('Enter a number for the maximum number of attempts.'),
);
/* Now replaced by application specific switches
$form['replication_http']['replication_http_cron_enabled'] = array (
'#type' => 'checkbox',
'#title' => 'Enable file replication using cron',
'#default_value' => variable_get('replication_http_cron_enabled', 0),
'#description' => t('Unless checked no attempt will be made to replicate files from master server')
);
*/
return system_settings_form($form);
}