function apachesolr_stats_admin in Apache Solr Statistics 6
Same name and namespace in other branches
- 6.3 apachesolr_stats.module \apachesolr_stats_admin()
- 7 apachesolr_stats.module \apachesolr_stats_admin()
Build the settings form.
1 string reference to 'apachesolr_stats_admin'
- apachesolr_stats_menu in ./
apachesolr_stats.module - Implementation of hook_menu().
File
- ./
apachesolr_stats.module, line 51 - Keeps and reports statistics about Apache Solr usage and performance.
Code
function apachesolr_stats_admin() {
$form = array();
$form['tip'] = array(
'#type' => 'markup',
'#value' => t('You can also visit the <a href="@report-url">report page</a>.', array(
'@report-url' => url('admin/reports/apachesolr/stats'),
)),
);
$form['apachesolr_stats_enabled'] = array(
'#type' => 'radios',
'#title' => t('Enable query log'),
'#default_value' => variable_get('apachesolr_stats_enabled', 0),
'#options' => array(
'1' => t('Enabled'),
'0' => t('Disabled'),
),
'#description' => t('Log information about all queries launched via the Apache Solr Search Integration module.'),
);
$periods = drupal_map_assoc(array(
3600,
10800,
21600,
32400,
43200,
86400,
172800,
259200,
604800,
1209600,
2419200,
4838400,
9676800,
), 'format_interval');
$form['apachesolr_stats_flush_log_timer'] = array(
'#type' => 'select',
'#title' => t('Discard query logs older than'),
'#default_value' => variable_get('apachesolr_stats_flush_log_timer', 259200),
'#options' => $periods,
'#description' => t('Older query log entries will be automatically discarded. (Requires a correctly configured <a href="@cron">cron maintenance task</a>.)', array(
'@cron' => url('admin/reports/status'),
)),
);
// Blacklist settings.
$form['access'] = array(
'#type' => 'fieldset',
'#title' => t('Log blacklist'),
'#description' => t('Note: Changing this does not alter existing logged queries.'),
);
$form['access']['apachesolr_stats_ignore_ip_list'] = array(
'#type' => 'textarea',
'#title' => t('IP addresses that will not be logged'),
'#default_value' => variable_get('apachesolr_stats_ignore_ip_list', ''),
'#description' => t('Enter IP addresses (e.g.: 192.168.1.2), one per line. You can match entire subnets using a partial IP address ending with a period (e.g.: 192.168.)'),
);
$form['access']['apachesolr_stats_ignore_role_list'] = array(
'#type' => 'checkboxes',
'#title' => t('User roles that will not be logged'),
'#options' => user_roles(),
'#default_value' => variable_get('apachesolr_stats_ignore_role_list', array()),
'#description' => t('Check all roles which should not be logged.'),
);
// Google gadget settings.
$form['gadget'] = array(
'#type' => 'fieldset',
'#title' => t('Google Gadget settings'),
'#description' => t('You can embed statistics displays via Google Gadget by configuring the setting below.'),
);
$key = variable_get("apachesolr_stats_gadget_key", "");
$form['gadget']['apachesolr_stats_gadget_key'] = array(
'#type' => 'textfield',
'#title' => t('Google Gadget secret key'),
'#description' => t("Enter a string that will be embedded in the Gadget URL. Leave empty to disable. WARNING: changing this setting will deactivate all installed gadgets; users can re-enable them by entering the new key in their gadget's preferences."),
'#default_value' => $key,
);
if ($key) {
$gadget_url = url("apachesolr_stats/gadget/{$key}", array(
'absolute' => TRUE,
));
$gadget_embed_url = 'http://fusion.google.com/add?source=atgs&moduleurl=' . urlencode($gadget_url);
$gadget_embed_html = "<a href='{$gadget_embed_url}'><img src='http://buttons.googlesyndication.com/fusion/add.gif' border='0' alt='Add to Google'></a>";
$form['gadget']['embed_link'] = array(
'#type' => 'markup',
'#value' => t('The gadget is currently available at these URLs:') . '<ul><li>' . l(t('Source'), $gadget_url) . '<li>' . l(t('Embed'), $gadget_embed_url) . ' ' . $gadget_embed_html . '</ul>',
);
}
return system_settings_form($form);
}