summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-01-02 16:28:45 +0000
committerDries Buytaert <dries@buytaert.net>2004-01-02 16:28:45 +0000
commitb63747fd30b575434fe5053724fe5e63b1c88df5 (patch)
treeed4eb97b48d170b9055f0cb1d3b0dfea76474e0c
parentf6082cda98eab9732801e815a05aad1017446b12 (diff)
downloadbrdo-b63747fd30b575434fe5053724fe5e63b1c88df5.tar.gz
brdo-b63747fd30b575434fe5053724fe5e63b1c88df5.tar.bz2
- Removed the hard-coded list of watchdog types. The list is compiled
dynamically and can be extended through the watchdog() call. (Chris could use it to move the cron message to their own category.)
-rw-r--r--cron.php2
-rw-r--r--modules/drupal.module2
-rw-r--r--modules/drupal/drupal.module2
-rw-r--r--modules/throttle.module2
-rw-r--r--modules/throttle/throttle.module2
-rw-r--r--modules/watchdog.module29
-rw-r--r--modules/watchdog/watchdog.module29
7 files changed, 49 insertions, 19 deletions
diff --git a/cron.php b/cron.php
index f7c9d6adb..70aee47fd 100644
--- a/cron.php
+++ b/cron.php
@@ -18,5 +18,5 @@ if (!ini_get("safe_mode")) {
module_invoke_all("cron");
-watchdog("message", "cron run completed");
+watchdog("regular", "cron run completed");
?>
diff --git a/modules/drupal.module b/modules/drupal.module
index 8ecb0aa74..4fa6a6041 100644
--- a/modules/drupal.module
+++ b/modules/drupal.module
@@ -80,7 +80,7 @@ function drupal_directory_ping($arguments) {
db_query("DELETE FROM {directory} WHERE link = '%s' OR mail = '%s'", $link, $mail);
db_query("INSERT INTO {directory} (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $link, $name, $mail, $slogan, $mission, time());
- watchdog("message", "directory: ping from '$name' ($link)");
+ watchdog("regular", "directory: ping from '$name' ($link)");
return new xmlrpcresp(new xmlrpcval(1, "int"));
}
diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module
index 8ecb0aa74..4fa6a6041 100644
--- a/modules/drupal/drupal.module
+++ b/modules/drupal/drupal.module
@@ -80,7 +80,7 @@ function drupal_directory_ping($arguments) {
db_query("DELETE FROM {directory} WHERE link = '%s' OR mail = '%s'", $link, $mail);
db_query("INSERT INTO {directory} (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $link, $name, $mail, $slogan, $mission, time());
- watchdog("message", "directory: ping from '$name' ($link)");
+ watchdog("regular", "directory: ping from '$name' ($link)");
return new xmlrpcresp(new xmlrpcval(1, "int"));
}
diff --git a/modules/throttle.module b/modules/throttle.module
index 3408be3eb..a40db7ea8 100644
--- a/modules/throttle.module
+++ b/modules/throttle.module
@@ -207,7 +207,7 @@ function _throttle_update($hits) {
variable_set("throttle_cron_timestamp", time());
/* log the change */
if ($throttle_new < $throttle) {
- watchdog("message", "message: '". $hits ."' hits in past minute; throttle decreased to level ". $throttle_new);
+ watchdog("regular", "message: '". $hits ."' hits in past minute; throttle decreased to level ". $throttle_new);
}
else {
watchdog("warning", "warning: '". $hits ."' hits in past minute; throttle increased to level ". $throttle_new);
diff --git a/modules/throttle/throttle.module b/modules/throttle/throttle.module
index 3408be3eb..a40db7ea8 100644
--- a/modules/throttle/throttle.module
+++ b/modules/throttle/throttle.module
@@ -207,7 +207,7 @@ function _throttle_update($hits) {
variable_set("throttle_cron_timestamp", time());
/* log the change */
if ($throttle_new < $throttle) {
- watchdog("message", "message: '". $hits ."' hits in past minute; throttle decreased to level ". $throttle_new);
+ watchdog("regular", "message: '". $hits ."' hits in past minute; throttle decreased to level ". $throttle_new);
}
else {
watchdog("warning", "warning: '". $hits ."' hits in past minute; throttle increased to level ". $throttle_new);
diff --git a/modules/watchdog.module b/modules/watchdog.module
index 2a6786d4d..f1f27a849 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -25,6 +25,9 @@ function watchdog_help($section = "admin/help#watchdog") {
case 'admin/watchdog/special':
$output = t("Watchdog events about adding, changing, and moderating nodes and comments.");
break;
+ case 'admin/watchdog/search':
+ $output = t("Watchdog events showing what users searched for.");
+ break;
case 'admin/watchdog/error':
$output = t("Watchdog events about PHP and database errors.");
break;
@@ -50,13 +53,11 @@ function watchdog_link($type) {
if ($type == "system") {
if (user_access("administer watchdog")) {
menu("admin/watchdog", t("messages"), "watchdog_admin", 6);
- menu("admin/watchdog/user", t("user"), "watchdog_admin");
- menu("admin/watchdog/regular", t("regular"), "watchdog_admin");
- menu("admin/watchdog/special", t("special"), "watchdog_admin");
- menu("admin/watchdog/warning", t("warning"), "watchdog_admin");
- menu("admin/watchdog/error", t("error"), "watchdog_admin");
- menu("admin/watchdog/httpd", t("httpd"), "watchdog_admin");
menu("admin/watchdog/view", t("view details"), "watchdog_admin", 0, MENU_HIDE);
+
+ foreach (_watchdog_get_message_types() as $type) {
+ menu("admin/watchdog/$type", t($type), "watchdog_admin");
+ }
}
}
}
@@ -72,7 +73,10 @@ function watchdog_cron() {
}
function watchdog_overview($type) {
- $query = array("user" => "WHERE type = 'user'", "regular" => "WHERE type = 'message'", "special" => "WHERE type = 'special'", "warning" => "WHERE type = 'warning'", "error" => "WHERE type = 'error'", "httpd" => "WHERE type = 'httpd'", "actions" => "WHERE link != ''");
+ foreach (_watchdog_get_message_types() as $key) {
+ $query[$key] = "WHERE type = '". check_query($key) ."'";
+ }
+ $query['actions'] = "WHERE link != ''";
$header = array(
array("data" => t("date"), "field" => "w.timestamp", "sort" => "desc"),
@@ -143,4 +147,15 @@ function watchdog_admin() {
}
}
+function _watchdog_get_message_types() {
+ $types = array();
+
+ $result = db_query("SELECT DISTINCT(type) FROM {watchdog}");
+ while ($object = db_fetch_object($result)) {
+ $types[] = $object->type;
+ }
+
+ return $types;
+}
+
?>
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 2a6786d4d..f1f27a849 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -25,6 +25,9 @@ function watchdog_help($section = "admin/help#watchdog") {
case 'admin/watchdog/special':
$output = t("Watchdog events about adding, changing, and moderating nodes and comments.");
break;
+ case 'admin/watchdog/search':
+ $output = t("Watchdog events showing what users searched for.");
+ break;
case 'admin/watchdog/error':
$output = t("Watchdog events about PHP and database errors.");
break;
@@ -50,13 +53,11 @@ function watchdog_link($type) {
if ($type == "system") {
if (user_access("administer watchdog")) {
menu("admin/watchdog", t("messages"), "watchdog_admin", 6);
- menu("admin/watchdog/user", t("user"), "watchdog_admin");
- menu("admin/watchdog/regular", t("regular"), "watchdog_admin");
- menu("admin/watchdog/special", t("special"), "watchdog_admin");
- menu("admin/watchdog/warning", t("warning"), "watchdog_admin");
- menu("admin/watchdog/error", t("error"), "watchdog_admin");
- menu("admin/watchdog/httpd", t("httpd"), "watchdog_admin");
menu("admin/watchdog/view", t("view details"), "watchdog_admin", 0, MENU_HIDE);
+
+ foreach (_watchdog_get_message_types() as $type) {
+ menu("admin/watchdog/$type", t($type), "watchdog_admin");
+ }
}
}
}
@@ -72,7 +73,10 @@ function watchdog_cron() {
}
function watchdog_overview($type) {
- $query = array("user" => "WHERE type = 'user'", "regular" => "WHERE type = 'message'", "special" => "WHERE type = 'special'", "warning" => "WHERE type = 'warning'", "error" => "WHERE type = 'error'", "httpd" => "WHERE type = 'httpd'", "actions" => "WHERE link != ''");
+ foreach (_watchdog_get_message_types() as $key) {
+ $query[$key] = "WHERE type = '". check_query($key) ."'";
+ }
+ $query['actions'] = "WHERE link != ''";
$header = array(
array("data" => t("date"), "field" => "w.timestamp", "sort" => "desc"),
@@ -143,4 +147,15 @@ function watchdog_admin() {
}
}
+function _watchdog_get_message_types() {
+ $types = array();
+
+ $result = db_query("SELECT DISTINCT(type) FROM {watchdog}");
+ while ($object = db_fetch_object($result)) {
+ $types[] = $object->type;
+ }
+
+ return $types;
+}
+
?>