summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.install40
-rw-r--r--modules/system/system.module34
2 files changed, 35 insertions, 39 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index 72b631a6e..06ad4d98c 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -603,21 +603,6 @@ function system_install() {
PRIMARY KEY (vid, type)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
- db_query("CREATE TABLE {watchdog} (
- wid int NOT NULL auto_increment,
- uid int NOT NULL default '0',
- type varchar(16) NOT NULL default '',
- message longtext NOT NULL,
- severity tinyint unsigned NOT NULL default '0',
- link varchar(255) NOT NULL default '',
- location text NOT NULL,
- referer varchar(128) NOT NULL default '',
- hostname varchar(128) NOT NULL default '',
- timestamp int NOT NULL default '0',
- PRIMARY KEY (wid),
- KEY (type)
- ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
-
break;
case 'pgsql':
/* create unsigned types */
@@ -1089,20 +1074,6 @@ function system_install() {
PRIMARY KEY (vid, type)
)");
- db_query("CREATE TABLE {watchdog} (
- wid serial,
- uid int NOT NULL default '0',
- type varchar(16) NOT NULL default '',
- message text NOT NULL,
- severity smallint_unsigned NOT NULL default '0',
- link varchar(255) NOT NULL default '',
- location text NOT NULL default '',
- referer varchar(128) NOT NULL default '',
- hostname varchar(128) NOT NULL default '',
- timestamp int NOT NULL default '0',
- PRIMARY KEY (wid)
- )");
- db_query("CREATE INDEX {watchdog}_type_idx ON {watchdog} (type)");
break;
}
@@ -3724,6 +3695,17 @@ function system_update_2006() {
}
/**
+ * Change the severity column in the watchdog table to the new values.
+ */
+function system_update_2007() {
+ $ret = array();
+ $ret[] = update_sql("UPDATE {watchdog} SET severity = %d WHERE severity = 0", WATCHDOG_NOTICE);
+ $ret[] = update_sql("UPDATE {watchdog} SET severity = %d WHERE severity = 1", WATCHDOG_WARNING);
+ $ret[] = update_sql("UPDATE {watchdog} SET severity = %d WHERE severity = 2", WATCHDOG_ERROR);
+ return $ret;
+}
+
+/**
* @} End of "defgroup updates-5.0-to-x.x"
* The next series of updates should start at 3000.
*/
diff --git a/modules/system/system.module b/modules/system/system.module
index 2df59c8c9..bab509f41 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -249,6 +249,11 @@ function system_menu() {
'page callback' => 'drupal_get_form',
'page arguments' => array('system_error_reporting_settings'),
);
+ $items['admin/settings/logging'] = array(
+ 'title' => t('Logging and alerts'),
+ 'description' => t('Settings for logging and alerts modules'),
+ 'page callback' => 'system_logging_overview',
+ );
$items['admin/settings/performance'] = array(
'title' => t('Performance'),
'description' => t('Enable or disable page caching for anonymous users, and enable or disable CSS preprocessor.'),
@@ -669,16 +674,6 @@ function system_error_reporting_settings() {
'#description' => t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.')
);
- $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
- $period['1000000000'] = t('Never');
- $form['watchdog_clear'] = array(
- '#type' => 'select',
- '#title' => t('Discard log entries older than'),
- '#default_value' => variable_get('watchdog_clear', 604800),
- '#options' => $period,
- '#description' => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.')
- );
-
return system_settings_form($form);
}
@@ -1953,6 +1948,14 @@ function system_settings_overview() {
return $output;
}
+function system_logging_overview() {
+ $item = menu_get_item('admin/settings/logging');
+ $content = system_admin_menu_block($item);
+
+ $output = theme('admin_block_content', $content);
+
+ return $output;
+}
/**
* Menu callback; display theme configuration for entire site and individual themes.
*/
@@ -2431,3 +2434,14 @@ function theme_system_admin_by_module($menu_items) {
return $output;
}
+
+/**
+ * Implementation of hook_cron().
+ *
+ * Remove older rows from flood table
+ */
+function system_cron() {
+ // Cleanup the flood
+ db_query('DELETE FROM {flood} WHERE timestamp < %d', time() - 3600);
+}
+