summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-01-09 09:22:40 +0000
committerDries Buytaert <dries@buytaert.net>2005-01-09 09:22:40 +0000
commit64b100d19ace2c9b82ced4438036a64a69eda3c3 (patch)
tree36a433e7cd27810edb315c2fc79e764742019b54 /modules
parent0830efe9a6c056d20a286880733fedcbd28b62fa (diff)
downloadbrdo-64b100d19ace2c9b82ced4438036a64a69eda3c3.tar.gz
brdo-64b100d19ace2c9b82ced4438036a64a69eda3c3.tar.bz2
- Patch #13260 by UnConeD: watchdog module improvements.
We added a 'severity' column to watchdog(): watchdog($type, $message, $link) --> watchdog($type, $message, $severity, $link); * Specify a severity in case you are reporting a warning or error. * The $link-parameter is now the fourth parameter instead of the third. TODO: document this in the upgrade guide.
Diffstat (limited to 'modules')
-rw-r--r--modules/aggregator.module17
-rw-r--r--modules/aggregator/aggregator.module17
-rw-r--r--modules/blogapi.module4
-rw-r--r--modules/blogapi/blogapi.module4
-rw-r--r--modules/book.module2
-rw-r--r--modules/book/book.module2
-rw-r--r--modules/comment.module12
-rw-r--r--modules/comment/comment.module12
-rw-r--r--modules/drupal.module4
-rw-r--r--modules/drupal/drupal.module4
-rw-r--r--modules/locale.module9
-rw-r--r--modules/locale/locale.module9
-rw-r--r--modules/node.module6
-rw-r--r--modules/node/node.module6
-rw-r--r--modules/ping.module2
-rw-r--r--modules/ping/ping.module2
-rw-r--r--modules/queue.module10
-rw-r--r--modules/user.module4
-rw-r--r--modules/user/user.module4
-rw-r--r--modules/watchdog.module19
-rw-r--r--modules/watchdog/watchdog.module19
21 files changed, 99 insertions, 69 deletions
diff --git a/modules/aggregator.module b/modules/aggregator.module
index a7d079517..813faed31 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -354,7 +354,7 @@ function aggregator_refresh($feed) {
break;
case 301:
$feed['url'] = $result->redirect_url;
- watchdog('special', t('Aggregator: updated URL for feed %title to %url.', array('%title' => '<em>'. $feed['title'] .'</em>', '%url' => '<em>'. $feed['url'] .'</em>')));
+ watchdog('aggregator', t('Updated URL for feed %title to %url.', array('%title' => '<em>'. $feed['title'] .'</em>', '%url' => '<em>'. $feed['url'] .'</em>')));
break;
case 200:
@@ -402,13 +402,15 @@ function aggregator_refresh($feed) {
cache_clear_all();
- watchdog('status', t('Aggregator: syndicated content from %site.', array('%site' => '<em>'. $feed[title] .'</em>')));
- drupal_set_message(t('Syndicated content from %site.', array('%site' => '<em>'. $feed['title'] .'</em>')));
+ $message = t('Syndicated content from %site.', array('%site' => '<em>'. $feed[title] .'</em>'));
+ watchdog('aggregator', $message);
+ drupal_set_message($message);
}
break;
default:
- watchdog('error', t('Aggregator: failed to parse RSS feed %site: %error.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => "<em>$result->code $result->error</em>")));
- drupal_set_message(t('Failed to parse RSS feed %site: %error.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => "<em>$result->code $result->error</em>")));
+ $message = t('Failed to parse RSS feed %site: %error.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => "<em>$result->code $result->error</em>"));
+ watchdog('aggregator', $message, WATCHDOG_WARNING);
+ drupal_set_message($message);
}
}
@@ -464,8 +466,9 @@ function aggregator_parse_feed(&$data, $feed) {
xml_set_character_data_handler($xml_parser, 'aggregator_element_data');
if (!xml_parse($xml_parser, $data, 1)) {
- watchdog('error', t('Aggregator: failed to parse RSS feed %site: %error at line %line.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))));
- drupal_set_message(t('Failed to parse RSS feed %site: %error at line %line.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), 'error');
+ $message = t('Failed to parse RSS feed %site: %error at line %line.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser)));
+ watchdog('aggregator', $message, WATCHDOG_WARNING);
+ drupal_set_message($message, 'error');
return 0;
}
xml_parser_free($xml_parser);
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index a7d079517..813faed31 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -354,7 +354,7 @@ function aggregator_refresh($feed) {
break;
case 301:
$feed['url'] = $result->redirect_url;
- watchdog('special', t('Aggregator: updated URL for feed %title to %url.', array('%title' => '<em>'. $feed['title'] .'</em>', '%url' => '<em>'. $feed['url'] .'</em>')));
+ watchdog('aggregator', t('Updated URL for feed %title to %url.', array('%title' => '<em>'. $feed['title'] .'</em>', '%url' => '<em>'. $feed['url'] .'</em>')));
break;
case 200:
@@ -402,13 +402,15 @@ function aggregator_refresh($feed) {
cache_clear_all();
- watchdog('status', t('Aggregator: syndicated content from %site.', array('%site' => '<em>'. $feed[title] .'</em>')));
- drupal_set_message(t('Syndicated content from %site.', array('%site' => '<em>'. $feed['title'] .'</em>')));
+ $message = t('Syndicated content from %site.', array('%site' => '<em>'. $feed[title] .'</em>'));
+ watchdog('aggregator', $message);
+ drupal_set_message($message);
}
break;
default:
- watchdog('error', t('Aggregator: failed to parse RSS feed %site: %error.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => "<em>$result->code $result->error</em>")));
- drupal_set_message(t('Failed to parse RSS feed %site: %error.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => "<em>$result->code $result->error</em>")));
+ $message = t('Failed to parse RSS feed %site: %error.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => "<em>$result->code $result->error</em>"));
+ watchdog('aggregator', $message, WATCHDOG_WARNING);
+ drupal_set_message($message);
}
}
@@ -464,8 +466,9 @@ function aggregator_parse_feed(&$data, $feed) {
xml_set_character_data_handler($xml_parser, 'aggregator_element_data');
if (!xml_parse($xml_parser, $data, 1)) {
- watchdog('error', t('Aggregator: failed to parse RSS feed %site: %error at line %line.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))));
- drupal_set_message(t('Failed to parse RSS feed %site: %error at line %line.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), 'error');
+ $message = t('Failed to parse RSS feed %site: %error at line %line.', array('%site' => '<em>'. $feed['title'] .'</em>', '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser)));
+ watchdog('aggregator', $message, WATCHDOG_WARNING);
+ drupal_set_message($message, 'error');
return 0;
}
xml_parser_free($xml_parser);
diff --git a/modules/blogapi.module b/modules/blogapi.module
index a85cfa919..36878ec2f 100644
--- a/modules/blogapi.module
+++ b/modules/blogapi.module
@@ -149,7 +149,7 @@ function blogapi_new_post($req_params) {
$nid = node_save($node);
if ($nid) {
- watchdog('special', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$nid"));
+ watchdog('content', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$nid"));
return new xmlrpcresp(new xmlrpcval($nid, 'string'));
}
@@ -209,7 +209,7 @@ function blogapi_edit_post($req_params) {
}
$nid = node_save($node);
if ($nid) {
- watchdog('special', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$nid"));
+ watchdog('content', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$nid"));
return new xmlrpcresp(new xmlrpcval(true, 'boolean'));
}
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index a85cfa919..36878ec2f 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -149,7 +149,7 @@ function blogapi_new_post($req_params) {
$nid = node_save($node);
if ($nid) {
- watchdog('special', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$nid"));
+ watchdog('content', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$nid"));
return new xmlrpcresp(new xmlrpcval($nid, 'string'));
}
@@ -209,7 +209,7 @@ function blogapi_edit_post($req_params) {
}
$nid = node_save($node);
if ($nid) {
- watchdog('special', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$nid"));
+ watchdog('content', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$nid"));
return new xmlrpcresp(new xmlrpcval(true, 'boolean'));
}
diff --git a/modules/book.module b/modules/book.module
index 78a624dce..06455fbed 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -723,7 +723,7 @@ function book_admin_save($nid, $edit = array()) {
}
$message = t('Updated book %title.', array('%title' => "<em>$book->title</em>"));
- watchdog('special', $message);
+ watchdog('content', $message);
return $message;
}
diff --git a/modules/book/book.module b/modules/book/book.module
index 78a624dce..06455fbed 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -723,7 +723,7 @@ function book_admin_save($nid, $edit = array()) {
}
$message = t('Updated book %title.', array('%title' => "<em>$book->title</em>"));
- watchdog('special', $message);
+ watchdog('content', $message);
return $message;
}
diff --git a/modules/comment.module b/modules/comment.module
index 6a3b8cee5..aa596f100 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -520,7 +520,7 @@ function comment_post($edit) {
// validated/filtered data to perform such check.
$duplicate = db_result(db_query("SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND nid = %d AND subject = '%s' AND comment = '%s'", $edit['pid'], $edit['nid'], $edit['subject'], $edit['comment']), 0);
if ($duplicate != 0) {
- watchdog('warning', t('Comment: duplicate %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')));
+ watchdog('content', t('Comment: duplicate %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), WATCHDOG_WARNING);
}
if ($edit['cid']) {
@@ -535,7 +535,7 @@ function comment_post($edit) {
module_invoke_all('comment', 'update', $edit);
// Add entry to the watchdog log.
- watchdog('special', t('Comment: updated %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
+ watchdog('content', t('Comment: updated %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
}
else {
// Add the comment to database.
@@ -638,7 +638,7 @@ function comment_post($edit) {
module_invoke_all('comment', 'insert', $edit);
// Add an entry to the watchdog log.
- watchdog('special', t('Comment: added %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
+ watchdog('content', t('Comment: added %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
}
// Clear the cache so an anonymous user can see his comment being added.
@@ -659,7 +659,7 @@ function comment_post($edit) {
}
}
else {
- watchdog('error', t('Comment: unauthorized comment submitted or comment submitted to a closed node %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')));
+ watchdog('content', t('Comment: unauthorized comment submitted or comment submitted to a closed node %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), WATCHDOG_WARNING);
}
}
@@ -986,7 +986,7 @@ function comment_delete($cid) {
function comment_save($id, $edit) {
db_query("UPDATE {comments} SET subject = '%s', comment = '%s', status = %d, format = '%s', name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d", $edit['subject'], $edit['comment'], $edit['status'], $edit['format'], $edit['name'], $edit['mail'], $edit['homepage'], $id);
- watchdog('special', t('Comment: modified %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')));
+ watchdog('content', t('Comment: modified %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')));
drupal_set_message(t('The comment has been saved.'));
}
@@ -1614,7 +1614,7 @@ function theme_comment_post_forbidden() {
function _comment_delete_thread($comment) {
// Delete the comment:
db_query('DELETE FROM {comments} WHERE cid = %d', $comment->cid);
- watchdog('special', t('Comment: deleted %subject.', array('%subject' => "<em>$comment->subject</em>")));
+ watchdog('content', t('Comment: deleted %subject.', array('%subject' => "<em>$comment->subject</em>")));
module_invoke_all('comment', 'delete', $comment);
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 6a3b8cee5..aa596f100 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -520,7 +520,7 @@ function comment_post($edit) {
// validated/filtered data to perform such check.
$duplicate = db_result(db_query("SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND nid = %d AND subject = '%s' AND comment = '%s'", $edit['pid'], $edit['nid'], $edit['subject'], $edit['comment']), 0);
if ($duplicate != 0) {
- watchdog('warning', t('Comment: duplicate %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')));
+ watchdog('content', t('Comment: duplicate %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), WATCHDOG_WARNING);
}
if ($edit['cid']) {
@@ -535,7 +535,7 @@ function comment_post($edit) {
module_invoke_all('comment', 'update', $edit);
// Add entry to the watchdog log.
- watchdog('special', t('Comment: updated %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
+ watchdog('content', t('Comment: updated %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
}
else {
// Add the comment to database.
@@ -638,7 +638,7 @@ function comment_post($edit) {
module_invoke_all('comment', 'insert', $edit);
// Add an entry to the watchdog log.
- watchdog('special', t('Comment: added %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
+ watchdog('content', t('Comment: added %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
}
// Clear the cache so an anonymous user can see his comment being added.
@@ -659,7 +659,7 @@ function comment_post($edit) {
}
}
else {
- watchdog('error', t('Comment: unauthorized comment submitted or comment submitted to a closed node %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')));
+ watchdog('content', t('Comment: unauthorized comment submitted or comment submitted to a closed node %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')), WATCHDOG_WARNING);
}
}
@@ -986,7 +986,7 @@ function comment_delete($cid) {
function comment_save($id, $edit) {
db_query("UPDATE {comments} SET subject = '%s', comment = '%s', status = %d, format = '%s', name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d", $edit['subject'], $edit['comment'], $edit['status'], $edit['format'], $edit['name'], $edit['mail'], $edit['homepage'], $id);
- watchdog('special', t('Comment: modified %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')));
+ watchdog('content', t('Comment: modified %subject.', array('%subject' => '<em>'. $edit['subject'] .'</em>')));
drupal_set_message(t('The comment has been saved.'));
}
@@ -1614,7 +1614,7 @@ function theme_comment_post_forbidden() {
function _comment_delete_thread($comment) {
// Delete the comment:
db_query('DELETE FROM {comments} WHERE cid = %d', $comment->cid);
- watchdog('special', t('Comment: deleted %subject.', array('%subject' => "<em>$comment->subject</em>")));
+ watchdog('content', t('Comment: deleted %subject.', array('%subject' => "<em>$comment->subject</em>")));
module_invoke_all('comment', 'delete', $comment);
diff --git a/modules/drupal.module b/modules/drupal.module
index a3494a29a..a0fa4a595 100644
--- a/modules/drupal.module
+++ b/modules/drupal.module
@@ -95,7 +95,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('directory ping', t('ping from %name (%link).', array('%name' => "<em>$name</em>", '%link' => "<em>$link</em>")));
+ watchdog('directory ping', t('Ping from %name (%link).', array('%name' => "<em>$name</em>", '%link' => "<em>$link</em>")));
return new xmlrpcresp(new xmlrpcval(1, 'int'));
}
@@ -143,7 +143,7 @@ function drupal_notify($server) {
$result = $client->send($message, 5);
if (!$result || $result->faultCode()) {
- watchdog('error', t('Failed to notify %url at %path: %error.', array('%url' => '<em>'. $url["host"] .'</em>', '%path' => '<em>'. $url["path"] .'</em>', '%error' => '<em>'. $result->faultString() .'</em>')));
+ watchdog('directory ping', t('Failed to notify %url at %path: %error.', array('%url' => '<em>'. $url["host"] .'</em>', '%path' => '<em>'. $url["path"] .'</em>', '%error' => '<em>'. $result->faultString() .'</em>')), WATCHDOG_WARNING);
}
}
diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module
index a3494a29a..a0fa4a595 100644
--- a/modules/drupal/drupal.module
+++ b/modules/drupal/drupal.module
@@ -95,7 +95,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('directory ping', t('ping from %name (%link).', array('%name' => "<em>$name</em>", '%link' => "<em>$link</em>")));
+ watchdog('directory ping', t('Ping from %name (%link).', array('%name' => "<em>$name</em>", '%link' => "<em>$link</em>")));
return new xmlrpcresp(new xmlrpcval(1, 'int'));
}
@@ -143,7 +143,7 @@ function drupal_notify($server) {
$result = $client->send($message, 5);
if (!$result || $result->faultCode()) {
- watchdog('error', t('Failed to notify %url at %path: %error.', array('%url' => '<em>'. $url["host"] .'</em>', '%path' => '<em>'. $url["path"] .'</em>', '%error' => '<em>'. $result->faultString() .'</em>')));
+ watchdog('directory ping', t('Failed to notify %url at %path: %error.', array('%url' => '<em>'. $url["host"] .'</em>', '%path' => '<em>'. $url["path"] .'</em>', '%error' => '<em>'. $result->faultString() .'</em>')), WATCHDOG_WARNING);
}
}
diff --git a/modules/locale.module b/modules/locale.module
index 097c75f72..f9c6da115 100644
--- a/modules/locale.module
+++ b/modules/locale.module
@@ -288,8 +288,9 @@ function locale_admin_manage() {
if (isset($languages['name'][$edit['langcode']])) {
db_query("DELETE FROM {locales_meta} WHERE locale = '%s'", $edit['langcode']);
db_query("DELETE FROM {locales_target} WHERE locale = '%s'", $edit['langcode']);
- drupal_set_message(t('%locale language removed.', array('%locale' => '<em>'. t($languages['name'][$edit['langcode']]) .'</em>')));
- watchdog('special', t('%locale language removed.', array('%locale' => '<em>'. $edit['langcode'] .'</em>')));
+ $message = t('%locale language removed.', array('%locale' => '<em>'. t($languages['name'][$edit['langcode']]) .'</em>'));
+ drupal_set_message($message);
+ watchdog('locale', $message);
}
// Changing the locale settings impacts the interface:
@@ -379,7 +380,9 @@ function locale_admin_import() {
// Now import strings into the language
$file = file_check_upload('file');
if ($ret = _locale_import_po($file, $edit['langcode'], $edit['mode']) == FALSE) {
- watchdog('error', t('Translation import of %filename failed.', array('%filename' => "<em>$file->filename</em>")));
+ $message = t('Translation import of %filename failed.', array('%filename' => "<em>$file->filename</em>"));
+ drupal_set_message($message, 'error');
+ watchdog('locale', $message, WATCHDOG_ERROR);
}
drupal_goto('admin/locale');
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 097c75f72..f9c6da115 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -288,8 +288,9 @@ function locale_admin_manage() {
if (isset($languages['name'][$edit['langcode']])) {
db_query("DELETE FROM {locales_meta} WHERE locale = '%s'", $edit['langcode']);
db_query("DELETE FROM {locales_target} WHERE locale = '%s'", $edit['langcode']);
- drupal_set_message(t('%locale language removed.', array('%locale' => '<em>'. t($languages['name'][$edit['langcode']]) .'</em>')));
- watchdog('special', t('%locale language removed.', array('%locale' => '<em>'. $edit['langcode'] .'</em>')));
+ $message = t('%locale language removed.', array('%locale' => '<em>'. t($languages['name'][$edit['langcode']]) .'</em>'));
+ drupal_set_message($message);
+ watchdog('locale', $message);
}
// Changing the locale settings impacts the interface:
@@ -379,7 +380,9 @@ function locale_admin_import() {
// Now import strings into the language
$file = file_check_upload('file');
if ($ret = _locale_import_po($file, $edit['langcode'], $edit['mode']) == FALSE) {
- watchdog('error', t('Translation import of %filename failed.', array('%filename' => "<em>$file->filename</em>")));
+ $message = t('Translation import of %filename failed.', array('%filename' => "<em>$file->filename</em>"));
+ drupal_set_message($message, 'error');
+ watchdog('locale', $message, WATCHDOG_ERROR);
}
drupal_goto('admin/locale');
diff --git a/modules/node.module b/modules/node.module
index 21655e1ef..ee931ad2b 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1400,7 +1400,7 @@ function node_submit(&$node) {
// perform this operation:
if (node_access('update', $node)) {
$node->nid = node_save($node);
- watchdog('special', t('%type: updated %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), 'node/'. $node->nid));
+ watchdog('content', t('%type: updated %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), 'node/'. $node->nid));
$msg = t('The %post was updated.', array ('%post' => node_invoke($node, 'node_name')));
}
}
@@ -1409,7 +1409,7 @@ function node_submit(&$node) {
// perform this operation:
if (node_access('create', $node)) {
$node->nid = node_save($node);
- watchdog('special', t('%type: added %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$node->nid"));
+ watchdog('content', t('%type: added %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$node->nid"));
$msg = t('Your %post was created.', array ('%post' => node_invoke($node, 'node_name')));
}
}
@@ -1444,7 +1444,7 @@ function node_delete($edit) {
search_wipe($node->nid, 'node');
}
- watchdog('special', t('%type: deleted %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")));
+ watchdog('content', t('%type: deleted %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")));
$output = t('The node has been deleted.');
}
else {
diff --git a/modules/node/node.module b/modules/node/node.module
index 21655e1ef..ee931ad2b 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1400,7 +1400,7 @@ function node_submit(&$node) {
// perform this operation:
if (node_access('update', $node)) {
$node->nid = node_save($node);
- watchdog('special', t('%type: updated %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), 'node/'. $node->nid));
+ watchdog('content', t('%type: updated %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), 'node/'. $node->nid));
$msg = t('The %post was updated.', array ('%post' => node_invoke($node, 'node_name')));
}
}
@@ -1409,7 +1409,7 @@ function node_submit(&$node) {
// perform this operation:
if (node_access('create', $node)) {
$node->nid = node_save($node);
- watchdog('special', t('%type: added %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$node->nid"));
+ watchdog('content', t('%type: added %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")), l(t('view'), "node/$node->nid"));
$msg = t('Your %post was created.', array ('%post' => node_invoke($node, 'node_name')));
}
}
@@ -1444,7 +1444,7 @@ function node_delete($edit) {
search_wipe($node->nid, 'node');
}
- watchdog('special', t('%type: deleted %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")));
+ watchdog('content', t('%type: deleted %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")));
$output = t('The node has been deleted.');
}
else {
diff --git a/modules/ping.module b/modules/ping.module
index 5e500fc26..11835f3d9 100644
--- a/modules/ping.module
+++ b/modules/ping.module
@@ -63,7 +63,7 @@ function ping_ping($name = '', $url = '') {
$result = $client->send($message);
if (!$result || $result->faultCode()) {
- watchdog('error', t('Failed to notify pingomatic.com (site).'));
+ watchdog('directory ping', t('Failed to notify pingomatic.com (site).'), WATCHDOG_WARNING);
}
}
diff --git a/modules/ping/ping.module b/modules/ping/ping.module
index 5e500fc26..11835f3d9 100644
--- a/modules/ping/ping.module
+++ b/modules/ping/ping.module
@@ -63,7 +63,7 @@ function ping_ping($name = '', $url = '') {
$result = $client->send($message);
if (!$result || $result->faultCode()) {
- watchdog('error', t('Failed to notify pingomatic.com (site).'));
+ watchdog('directory ping', t('Failed to notify pingomatic.com (site).'), WATCHDOG_WARNING);
}
}
diff --git a/modules/queue.module b/modules/queue.module
index 46d4a6d71..03fa0eeeb 100644
--- a/modules/queue.module
+++ b/modules/queue.module
@@ -78,34 +78,34 @@ function queue_vote($node, $vote) {
$node->moderate = 0;
$node->promote = 1;
node_save($node);
- watchdog('special', t('Moderation: approved %title.', array('%title' => "<em>$node->title</em>")));
+ watchdog('content', t('Moderation: approved %title.', array('%title' => "<em>$node->title</em>")));
drupal_set_message(t('The post is promoted.'));
}
else if (variable_get('queue_threshold_dump', -2) >= $node->score) {
if ($node->revisions) {
node_revision_rollback($node, end(node_revision_list($node)));
- watchdog('special', t('Moderation: declined %title (rollback).', array('%title' => "<em>$node->title</em>")));
+ watchdog('content', t('Moderation: declined %title (rollback).', array('%title' => "<em>$node->title</em>")));
drupal_set_message(t('The post has been declined and the previous version has been restored.'));
}
else {
$node->moderate = 0;
$node->status = 0;
node_save($node);
- watchdog('special', t('Moderation: declined %title.', array('%title' => "<em>$node->title</em>")));
+ watchdog('content', t('Moderation: declined %title.', array('%title' => "<em>$node->title</em>")));
drupal_set_message(t('The post has been declined.'));
}
}
else if (variable_get('queue_threshold_expire', 8) <= $node->votes) {
if ($node->revisions) {
node_revision_rollback($node, end(node_revision_list($node)));
- watchdog('special', t('Moderation: expired %title (rollback).', array('%title' => "<em>$node->title</em>")));
+ watchdog('content', t('Moderation: expired %title (rollback).', array('%title' => "<em>$node->title</em>")));
drupal_set_message(t('The post has expired and the previous version has been restored.'));
}
else {
$node->moderate = 0;
$node->status = 0;
node_save($node);
- watchdog('special', t('Moderation: expired %title.', array('%title' => "<em>$node->title</em>")));
+ watchdog('content', t('Moderation: expired %title.', array('%title' => "<em>$node->title</em>")));
drupal_set_message(t('The post has expired.'));
}
}
diff --git a/modules/user.module b/modules/user.module
index ea376535c..9db351468 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -936,7 +936,7 @@ function user_pass() {
drupal_set_message(t('Your password and further instructions have been sent to your e-mail address.'));
}
else {
- watchdog('error', t('Error mailing password to %name at %email.', array('%name' => '<em>'. $account->name .'</em>', '%email' => '<em>'. $account->mail .'</em>')));
+ watchdog('user', t('Error mailing password to %name at %email.', array('%name' => '<em>'. $account->name .'</em>', '%email' => '<em>'. $account->mail .'</em>')), WATCHDOG_ERROR);
drupal_set_message(t('Unable to send mail. Please contact the site admin.'));
}
drupal_goto('user');
@@ -1133,7 +1133,7 @@ function user_edit($category = 'account') {
if (!form_get_errors()) {
// Validate input to ensure that non-privileged users can't alter protected data.
if (!user_access('administer users') && array_intersect(array_keys($edit), array('uid', 'roles', 'init', 'session'))) {
- watchdog('warning', t('Detected malicious attempt to alter protected user fields.'));
+ watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING);
}
else {
user_save($account, $edit, $category);
diff --git a/modules/user/user.module b/modules/user/user.module
index ea376535c..9db351468 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -936,7 +936,7 @@ function user_pass() {
drupal_set_message(t('Your password and further instructions have been sent to your e-mail address.'));
}
else {
- watchdog('error', t('Error mailing password to %name at %email.', array('%name' => '<em>'. $account->name .'</em>', '%email' => '<em>'. $account->mail .'</em>')));
+ watchdog('user', t('Error mailing password to %name at %email.', array('%name' => '<em>'. $account->name .'</em>', '%email' => '<em>'. $account->mail .'</em>')), WATCHDOG_ERROR);
drupal_set_message(t('Unable to send mail. Please contact the site admin.'));
}
drupal_goto('user');
@@ -1133,7 +1133,7 @@ function user_edit($category = 'account') {
if (!form_get_errors()) {
// Validate input to ensure that non-privileged users can't alter protected data.
if (!user_access('administer users') && array_intersect(array_keys($edit), array('uid', 'roles', 'init', 'session'))) {
- watchdog('warning', t('Detected malicious attempt to alter protected user fields.'));
+ watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING);
}
else {
user_save($account, $edit, $category);
diff --git a/modules/watchdog.module b/modules/watchdog.module
index 8d0a4c42f..2a20d5e7d 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -63,6 +63,11 @@ function watchdog_cron() {
* Menu callback; displays a listing of log messages.
*/
function watchdog_overview() {
+ $icons = array(WATCHDOG_NOTICE => '',
+ WATCHDOG_WARNING => theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')),
+ WATCHDOG_ERROR => theme('image', 'misc/watchdog-error.png', t('error'), t('error')));
+ $classes = array(WATCHDOG_NOTICE => 'watchdog-notice', WATCHDOG_WARNING => 'watchdog-warning', WATCHDOG_ERROR => 'watchdog-error');
+
$names['all'] = t('all messages');
$queries['all'] = '';
foreach (_watchdog_get_message_types() as $type) {
@@ -83,6 +88,7 @@ function watchdog_overview() {
$form .= form_submit(t('Filter'));
$header = array(
+ ' ',
array('data' => t('Type'), 'field' => 'w.type'),
array('data' => t('Date'), 'field' => 'w.timestamp', 'sort' => 'desc'),
array('data' => t('Message'), 'field' => 'w.message'),
@@ -96,25 +102,26 @@ function watchdog_overview() {
$rows[] = array('data' =>
array(
// Cells
+ $icons[$watchdog->severity],
$watchdog->type,
format_date($watchdog->timestamp, 'small'),
- truncate_utf8(strip_tags($watchdog->message), 64),
+ truncate_utf8($watchdog->message, 64),
format_name($watchdog),
$watchdog->link,
l(t('details'), "admin/logs/event/$watchdog->wid")
),
// Attributes for tr
- 'class' => "watchdog-$watchdog->type"
+ 'class' => "watchdog-". preg_replace('/[^a-z]/i', '-', $watchdog->type) .' '. $classes[$watchdog->severity]
);
}
if (!$rows) {
- $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => '6'));
+ $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => '7'));
}
$pager = theme('pager', NULL, 50, 0, tablesort_pager());
if (!empty($pager)) {
- $rows[] = array(array('data' => $pager, 'colspan' => '6'));
+ $rows[] = array(array('data' => $pager, 'colspan' => '7'));
}
$output = '<div class="container-inline">'. form($form) .'</div>';
@@ -127,6 +134,7 @@ function watchdog_overview() {
* Menu callback; displays details about a log message.
*/
function watchdog_event($id) {
+ $severity = array(WATCHDOG_NOTICE => t('notice'), WATCHDOG_WARNING => t('warning'), WATCHDOG_ERROR => t('error'));
$output = '';
$result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE w.wid = %d', $id);
if ($watchdog = db_fetch_object($result)) {
@@ -136,6 +144,7 @@ function watchdog_event($id) {
$output .= ' <tr><th>'. t('User') .'</th><td>'. format_name($watchdog) .'</td></tr>';
$output .= ' <tr><th>'. t('Location') ."</th><td>". l($watchdog->location, $watchdog->location) ."</td></tr>";
$output .= ' <tr><th>'. t('Message') ."</th><td>$watchdog->message</td></tr>";
+ $output .= ' <tr><th>'. t('Severity') .'</th><td>'. $severity[$watchdog->severity] .'</td></tr>';
$output .= ' <tr><th>'. t('Hostname') ."</th><td>$watchdog->hostname</td></tr>";
$output .= '</table>';
}
@@ -145,7 +154,7 @@ function watchdog_event($id) {
function _watchdog_get_message_types() {
$types = array();
- $result = db_query('SELECT DISTINCT(type) FROM {watchdog}');
+ $result = db_query('SELECT DISTINCT(type) FROM {watchdog} ORDER BY type');
while ($object = db_fetch_object($result)) {
$types[] = $object->type;
}
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 8d0a4c42f..2a20d5e7d 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -63,6 +63,11 @@ function watchdog_cron() {
* Menu callback; displays a listing of log messages.
*/
function watchdog_overview() {
+ $icons = array(WATCHDOG_NOTICE => '',
+ WATCHDOG_WARNING => theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')),
+ WATCHDOG_ERROR => theme('image', 'misc/watchdog-error.png', t('error'), t('error')));
+ $classes = array(WATCHDOG_NOTICE => 'watchdog-notice', WATCHDOG_WARNING => 'watchdog-warning', WATCHDOG_ERROR => 'watchdog-error');
+
$names['all'] = t('all messages');
$queries['all'] = '';
foreach (_watchdog_get_message_types() as $type) {
@@ -83,6 +88,7 @@ function watchdog_overview() {
$form .= form_submit(t('Filter'));
$header = array(
+ ' ',
array('data' => t('Type'), 'field' => 'w.type'),
array('data' => t('Date'), 'field' => 'w.timestamp', 'sort' => 'desc'),
array('data' => t('Message'), 'field' => 'w.message'),
@@ -96,25 +102,26 @@ function watchdog_overview() {
$rows[] = array('data' =>
array(
// Cells
+ $icons[$watchdog->severity],
$watchdog->type,
format_date($watchdog->timestamp, 'small'),
- truncate_utf8(strip_tags($watchdog->message), 64),
+ truncate_utf8($watchdog->message, 64),
format_name($watchdog),
$watchdog->link,
l(t('details'), "admin/logs/event/$watchdog->wid")
),
// Attributes for tr
- 'class' => "watchdog-$watchdog->type"
+ 'class' => "watchdog-". preg_replace('/[^a-z]/i', '-', $watchdog->type) .' '. $classes[$watchdog->severity]
);
}
if (!$rows) {
- $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => '6'));
+ $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => '7'));
}
$pager = theme('pager', NULL, 50, 0, tablesort_pager());
if (!empty($pager)) {
- $rows[] = array(array('data' => $pager, 'colspan' => '6'));
+ $rows[] = array(array('data' => $pager, 'colspan' => '7'));
}
$output = '<div class="container-inline">'. form($form) .'</div>';
@@ -127,6 +134,7 @@ function watchdog_overview() {
* Menu callback; displays details about a log message.
*/
function watchdog_event($id) {
+ $severity = array(WATCHDOG_NOTICE => t('notice'), WATCHDOG_WARNING => t('warning'), WATCHDOG_ERROR => t('error'));
$output = '';
$result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE w.wid = %d', $id);
if ($watchdog = db_fetch_object($result)) {
@@ -136,6 +144,7 @@ function watchdog_event($id) {
$output .= ' <tr><th>'. t('User') .'</th><td>'. format_name($watchdog) .'</td></tr>';
$output .= ' <tr><th>'. t('Location') ."</th><td>". l($watchdog->location, $watchdog->location) ."</td></tr>";
$output .= ' <tr><th>'. t('Message') ."</th><td>$watchdog->message</td></tr>";
+ $output .= ' <tr><th>'. t('Severity') .'</th><td>'. $severity[$watchdog->severity] .'</td></tr>';
$output .= ' <tr><th>'. t('Hostname') ."</th><td>$watchdog->hostname</td></tr>";
$output .= '</table>';
}
@@ -145,7 +154,7 @@ function watchdog_event($id) {
function _watchdog_get_message_types() {
$types = array();
- $result = db_query('SELECT DISTINCT(type) FROM {watchdog}');
+ $result = db_query('SELECT DISTINCT(type) FROM {watchdog} ORDER BY type');
while ($object = db_fetch_object($result)) {
$types[] = $object->type;
}