- Patch #394382 by Xano, dereine: clean up logging configuration page.
parent
a4501a2cca
commit
976dc16b0c
|
@ -7,21 +7,17 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* dblog module settings form.
|
||||
*
|
||||
* @ingroup forms
|
||||
* @see system_settings_form()
|
||||
* Implementation of hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function dblog_admin_settings() {
|
||||
function dblog_form_system_logging_settings_alter(&$form, $form_state) {
|
||||
$form['dblog_row_limit'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Discard log entries above the following row limit'),
|
||||
'#default_value' => 1000,
|
||||
'#title' => t('Database log entries to keep'),
|
||||
'#default_value' => variable_get('dblog_row_limit', 1000),
|
||||
'#options' => drupal_map_assoc(array(100, 1000, 10000, 100000, 1000000)),
|
||||
'#description' => t('The maximum number of rows to keep in the database log. Older entries will be automatically discarded. (Requires a correctly configured <a href="@cron">cron maintenance task</a>.)', array('@cron' => url('admin/reports/status')))
|
||||
'#description' => t('The maximum number of entries to keep in the database log. Requires a <a href="@cron">cron maintenance task</a>.', array('@cron' => url('admin/reports/status')))
|
||||
);
|
||||
|
||||
return system_settings_form($form, TRUE);
|
||||
$form['buttons']['#weight'] = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,14 +42,6 @@ function dblog_theme() {
|
|||
* Implementation of hook_menu().
|
||||
*/
|
||||
function dblog_menu() {
|
||||
$items['admin/settings/logging/dblog'] = array(
|
||||
'title' => 'Database logging',
|
||||
'description' => 'Settings for logging to the Drupal database logs. This is the most common method for small to medium sites on shared hosting. The logs are viewable from the admin pages.',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('dblog_admin_settings'),
|
||||
'access arguments' => array('administer site configuration'),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
);
|
||||
$items['admin/reports/dblog'] = array(
|
||||
'title' => 'Recent log entries',
|
||||
'description' => 'View events that have recently been logged.',
|
||||
|
|
|
@ -50,7 +50,7 @@ class DBLogTestCase extends DrupalWebTestCase {
|
|||
// Change the dblog row limit.
|
||||
$edit = array();
|
||||
$edit['dblog_row_limit'] = $row_limit;
|
||||
$this->drupalPost('admin/settings/logging/dblog', $edit, t('Save configuration'));
|
||||
$this->drupalPost('admin/settings/logging', $edit, t('Save configuration'));
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Check row limit variable.
|
||||
|
|
|
@ -26,28 +26,19 @@ function syslog_help($path, $arg) {
|
|||
}
|
||||
}
|
||||
|
||||
function syslog_menu() {
|
||||
$items['admin/settings/logging/syslog'] = array(
|
||||
'title' => 'Syslog logging',
|
||||
'description' => 'Settings for syslog logging. Syslog is an operating system administrative logging tool used in systems management and security auditing. Most suited to medium and large sites, syslog provides filtering tools that allow messages to be routed by type and severity.',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('syslog_admin_settings'),
|
||||
'access arguments' => array('administer site configuration'),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
);
|
||||
return $items;
|
||||
}
|
||||
|
||||
function syslog_admin_settings() {
|
||||
/**
|
||||
* Implementation of hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function syslog_form_system_logging_settings_alter(&$form, &$form_state) {
|
||||
$form['syslog_facility'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Send events to this syslog facility'),
|
||||
'#default_value' => DEFAULT_SYSLOG_FACILITY,
|
||||
'#default_value' => variable_get('syslog_facility', DEFAULT_SYSLOG_FACILITY),
|
||||
'#options' => syslog_facility_list(),
|
||||
'#description' => t('Select the syslog facility code under which Drupal\'s messages should be sent. On UNIX/Linux systems, Drupal can flag its messages with the code LOG_LOCAL0 through LOG_LOCAL7; for Microsoft Windows, all messages are flagged with the code LOG_USER. Depending on the system configuration, syslog and other logging tools use this code to identify or filter Drupal messages from within the entire system log. For more information on syslog, see <a href="@syslog_help">Syslog help</a>.', array(
|
||||
'@syslog_help' => url('admin/help/syslog'))),
|
||||
);
|
||||
return system_settings_form($form, TRUE);
|
||||
$form['buttons']['#weight'] = 1;
|
||||
}
|
||||
|
||||
function syslog_facility_list() {
|
||||
|
|
|
@ -29,10 +29,10 @@ class SyslogTestCase extends DrupalWebTestCase {
|
|||
else {
|
||||
$edit['syslog_facility'] = LOG_USER;
|
||||
}
|
||||
$this->drupalPost('admin/settings/logging/syslog', $edit, t('Save configuration'));
|
||||
$this->drupalPost('admin/settings/logging', $edit, t('Save configuration'));
|
||||
$this->assertText(t('The configuration options have been saved.'));
|
||||
|
||||
$this->drupalGet('admin/settings/logging/syslog');
|
||||
$this->drupalGet('admin/settings/logging');
|
||||
if ($this->parse()) {
|
||||
$field = $this->xpath('//option[@value="' . $edit['syslog_facility'] . '"]'); // Should be one field.
|
||||
$this->assertTrue($field[0]['selected'] == 'selected', t('Facility value saved.'));
|
||||
|
|
Loading…
Reference in New Issue