diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/aggregator/aggregator.module | 16 | ||||
-rw-r--r-- | modules/blogapi/blogapi.module | 4 | ||||
-rw-r--r-- | modules/book/book.module | 2 | ||||
-rw-r--r-- | modules/contact/contact.module | 10 | ||||
-rw-r--r-- | modules/dblog/dblog.install | 2 | ||||
-rw-r--r-- | modules/dblog/dblog.module | 34 | ||||
-rw-r--r-- | modules/drupal/drupal.module | 4 | ||||
-rw-r--r-- | modules/filter/filter.module | 2 | ||||
-rw-r--r-- | modules/forum/forum.module | 2 | ||||
-rw-r--r-- | modules/locale/locale.module | 6 | ||||
-rw-r--r-- | modules/menu/menu.module | 6 | ||||
-rw-r--r-- | modules/node/content_types.inc | 4 | ||||
-rw-r--r-- | modules/node/node.module | 10 | ||||
-rw-r--r-- | modules/ping/ping.module | 2 | ||||
-rw-r--r-- | modules/profile/profile.module | 4 | ||||
-rw-r--r-- | modules/search/search.module | 2 | ||||
-rw-r--r-- | modules/syslog/syslog.module | 3 | ||||
-rw-r--r-- | modules/system/system.install | 24 |
18 files changed, 89 insertions, 48 deletions
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index ead329dad..a544a286e 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -395,7 +395,7 @@ function aggregator_form_category_submit($form_id, $form_values) { } } else { - watchdog('aggregator', t('Category %category deleted.', array('%category' => $title))); + watchdog('aggregator', 'Category %category deleted.', array('%category' => $title)); drupal_set_message(t('The category %category has been deleted.', array('%category' => $title))); if (arg(0) == 'admin') { return 'admin/content/aggregator/'; @@ -406,7 +406,7 @@ function aggregator_form_category_submit($form_id, $form_values) { } } else { - watchdog('aggregator', t('Category %category added.', array('%category' => $form_values['title'])), WATCHDOG_NOTICE, l(t('view'), 'admin/content/aggregator')); + watchdog('aggregator', 'Category %category added.', array('%category' => $form_values['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/content/aggregator')); drupal_set_message(t('The category %category has been added.', array('%category' => $form_values['title']))); } } @@ -531,7 +531,7 @@ function aggregator_form_feed_submit($form_id, $form_values) { } } else { - watchdog('aggregator', t('Feed %feed deleted.', array('%feed' => $title))); + watchdog('aggregator', 'Feed %feed deleted.', array('%feed' => $title)); drupal_set_message(t('The feed %feed has been deleted.', array('%feed' => $title))); if (arg(0) == 'admin') { return 'admin/content/aggregator/'; @@ -542,7 +542,7 @@ function aggregator_form_feed_submit($form_id, $form_values) { } } else { - watchdog('aggregator', t('Feed %feed added.', array('%feed' => $form_values['title'])), WATCHDOG_NOTICE, l(t('view'), 'admin/content/aggregator')); + watchdog('aggregator', 'Feed %feed added.', array('%feed' => $form_values['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/content/aggregator')); drupal_set_message(t('The feed %feed has been added.', array('%feed' => $form_values['title']))); } } @@ -731,7 +731,7 @@ function aggregator_refresh($feed) { break; case 301: $feed['url'] = $result->redirect_url; - watchdog('aggregator', t('Updated URL for feed %title to %url.', array('%title' => $feed['title'], '%url' => $feed['url']))); + watchdog('aggregator', 'Updated URL for feed %title to %url.', array('%title' => $feed['title'], '%url' => $feed['url'])); case 200: case 302: @@ -779,12 +779,12 @@ function aggregator_refresh($feed) { cache_clear_all(); - watchdog('aggregator', t('There is new syndicated content from %site.', array('%site' => $feed['title']))); + watchdog('aggregator', 'There is new syndicated content from %site.', array('%site' => $feed['title'])); drupal_set_message(t('There is new syndicated content from %site.', array('%site' => $feed['title']))); } break; default: - watchdog('aggregator', t('The feed from %site seems to be broken, due to "%error".', array('%site' => $feed['title'], '%error' => $result->code .' '. $result->error)), WATCHDOG_WARNING); + watchdog('aggregator', 'The feed from %site seems to be broken, due to "%error".', array('%site' => $feed['title'], '%error' => $result->code .' '. $result->error), WATCHDOG_WARNING); drupal_set_message(t('The feed from %site seems to be broken, because of error "%error".', array('%site' => $feed['title'], '%error' => $result->code .' '. $result->error))); } } @@ -841,7 +841,7 @@ function aggregator_parse_feed(&$data, $feed) { xml_set_character_data_handler($xml_parser, 'aggregator_element_data'); if (!xml_parse($xml_parser, $data, 1)) { - watchdog('aggregator', t('The feed from %site seems to be broken, due to an error "%error" on line %line.', array('%site' => $feed['title'], '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), WATCHDOG_WARNING); + watchdog('aggregator', 'The feed from %site seems to be broken, due to an error "%error" on line %line.', array('%site' => $feed['title'], '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser)), WATCHDOG_WARNING); drupal_set_message(t('The feed from %site seems to be broken, because of error "%error" on line %line.', array('%site' => $feed['title'], '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), 'error'); return 0; } diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module index fa6cfc0fa..d003ff421 100644 --- a/modules/blogapi/blogapi.module +++ b/modules/blogapi/blogapi.module @@ -218,7 +218,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte $node = node_submit($edit); node_save($node); if ($node->nid) { - watchdog('content', t('@type: added %title using blog API.', array('@type' => t($node->type), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid")); + watchdog('content', '@type: added %title using blog API.', array('@type' => $node->type, '%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid")); // blogger.newPost returns a string so we cast the nid to a string by putting it in double quotes: return "$node->nid"; } @@ -274,7 +274,7 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont $node = node_submit($node); node_save($node); if ($node->nid) { - watchdog('content', t('@type: updated %title using blog API.', array('@type' => t($node->type), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid")); + watchdog('content', '@type: updated %title using blog API.', array('@type' => $node->type, '%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid")); return TRUE; } diff --git a/modules/book/book.module b/modules/book/book.module index 9451e623d..5c1c2e0bd 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -939,7 +939,7 @@ function book_admin_edit_submit($form_id, $form_values) { $node->weight = $row['weight']; node_save($node); - watchdog('content', t('%type: updated %title.', array('%type' => t('book'), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid)); + watchdog('content', 'book: updated %title.', array('%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid)); } } diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 23d4e3cdf..cb3f7712a 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -243,13 +243,13 @@ function contact_admin_edit_submit($form_id, $form_values) { if (arg(3) == 'add') { db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']); drupal_set_message(t('Category %category has been added.', array('%category' => $form_values['category']))); - watchdog('mail', t('Contact form: category %category added.', array('%category' => $form_values['category'])), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact')); + watchdog('mail', 'Contact form: category %category added.', array('%category' => $form_values['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact')); } else { db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid = %d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']); drupal_set_message(t('Category %category has been updated.', array('%category' => $form_values['category']))); - watchdog('mail', t('Contact form: category %category updated.', array('%category' => $form_values['category'])), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact')); + watchdog('mail', 'Contact form: category %category updated.', array('%category' => $form_values['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact')); } return 'admin/build/contact'; @@ -278,7 +278,7 @@ function contact_admin_delete($cid = NULL) { function contact_admin_delete_submit($form_id, $form_values) { db_query("DELETE FROM {contact} WHERE cid = %d", arg(4)); drupal_set_message(t('Category %category has been deleted.', array('%category' => $form_values['category']))); - watchdog('mail', t('Contact form: category %category deleted.', array('%category' => $form_values['category'])), WATCHDOG_NOTICE); + watchdog('mail', 'Contact form: category %category deleted.', array('%category' => $form_values['category']), WATCHDOG_NOTICE); return 'admin/build/contact'; } @@ -393,7 +393,7 @@ function contact_mail_user_submit($form_id, $form_values) { // Log the operation: flood_register_event('contact'); - watchdog('mail', t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name))); + watchdog('mail', '%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name)); // Set a status message: drupal_set_message(t('The message has been sent.')); @@ -544,7 +544,7 @@ function contact_mail_page_submit($form_id, $form_values) { // Log the operation: flood_register_event('contact'); - watchdog('mail', t('%name-from sent an e-mail regarding %category.', array('%name-from' => $form_values['name'] ." <$from>", '%category' => $contact->category))); + watchdog('mail', '%name-from sent an e-mail regarding %category.', array('%name-from' => $form_values['name'] ." <$from>", '%category' => $contact->category)); // Update user: drupal_set_message(t('Your message has been sent.')); diff --git a/modules/dblog/dblog.install b/modules/dblog/dblog.install index f94bab651..44961f7b1 100644 --- a/modules/dblog/dblog.install +++ b/modules/dblog/dblog.install @@ -13,6 +13,7 @@ function dblog_install() { uid int NOT NULL default '0', type varchar(16) NOT NULL default '', message longtext NOT NULL, + variables longtext NOT NULL, severity tinyint unsigned NOT NULL default '0', link varchar(255) NOT NULL default '', location text NOT NULL, @@ -30,6 +31,7 @@ function dblog_install() { uid int NOT NULL default '0', type varchar(16) NOT NULL default '', message text NOT NULL, + variables text NOT NULL, severity smallint_unsigned NOT NULL default '0', link varchar(255) NOT NULL default '', location text NOT NULL default '', diff --git a/modules/dblog/dblog.module b/modules/dblog/dblog.module index 6af3d2613..ad72a5e7b 100644 --- a/modules/dblog/dblog.module +++ b/modules/dblog/dblog.module @@ -159,12 +159,12 @@ function dblog_overview() { ' ', array('data' => t('Type'), 'field' => 'w.type'), array('data' => t('Date'), 'field' => 'w.wid', 'sort' => 'desc'), - array('data' => t('Message'), 'field' => 'w.message'), + t('Message'), array('data' => t('User'), 'field' => 'u.name'), array('data' => t('Operations')) ); - $sql = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid"; + $sql = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.variables, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid"; $tablesort = tablesort_sql($header); $type = $_SESSION['dblog_overview_filter']; if ($type != 'all') { @@ -181,7 +181,7 @@ function dblog_overview() { $icons[$dblog->severity], t($dblog->type), format_date($dblog->timestamp, 'small'), - l(truncate_utf8($dblog->message, 56, TRUE, TRUE), 'admin/logs/event/'. $dblog->wid, array('html' => TRUE)), + l(truncate_utf8(_dblog_format_message($dblog), 56, TRUE, TRUE), 'admin/logs/event/'. $dblog->wid, array('html' => TRUE)), theme('username', $dblog), $dblog->link, ), @@ -211,11 +211,11 @@ function dblog_top($type) { array('data' => t('Message'), 'field' => 'message') ); - $result = pager_query("SELECT COUNT(wid) AS count, message FROM {watchdog} WHERE type = '%s' GROUP BY message ". tablesort_sql($header), 30, 0, "SELECT COUNT(DISTINCT(message)) FROM {watchdog} WHERE type = '%s'", $type); + $result = pager_query("SELECT COUNT(wid) AS count, message, variables FROM {watchdog} WHERE type = '%s' GROUP BY message ". tablesort_sql($header), 30, 0, "SELECT COUNT(DISTINCT(message)) FROM {watchdog} WHERE type = '%s'", $type); $rows = array(); while ($dblog = db_fetch_object($result)) { - $rows[] = array($dblog->count, truncate_utf8($dblog->message, 56, TRUE, TRUE)); + $rows[] = array($dblog->count, truncate_utf8(_dblog_format_message($dblog), 56, TRUE, TRUE)); } if (empty($rows)) { @@ -267,7 +267,7 @@ function dblog_event($id) { ), array( array('data' => t('Message'), 'header' => TRUE), - $dblog->message, + _dblog_format_message($dblog), ), array( array('data' => t('Severity'), 'header' => TRUE), @@ -302,12 +302,13 @@ function _dblog_get_message_types() { function dblog_watchdog($log = array()) { $current_db = db_set_active(); db_query("INSERT INTO {watchdog} - (uid, type, message, severity, link, location, referer, hostname, timestamp) + (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES - (%d, '%s', '%s', %d, '%s', '%s', '%s', '%s', %d)", + (%d, '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', %d)", $log['user']->uid, $log['type'], $log['message'], + serialize($log['variables']), $log['severity'], $log['link'], $log['request_uri'], @@ -319,3 +320,20 @@ function dblog_watchdog($log = array()) { db_set_active($current_db); } } + +/** + * Formats a log message for display. + * + * @param $dblog + * An object with at least the message and variables properties + */ +function _dblog_format_message($dblog) { + // Legacy messages and user specified text + if ($dblog->variables === 'N;') { + return $dblog->message; + } + // Message to translate with injected variables + else { + return t($dblog->message, unserialize($dblog->variables)); + } +} diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module index 980467109..a75b48478 100644 --- a/modules/drupal/drupal.module +++ b/modules/drupal/drupal.module @@ -205,7 +205,7 @@ function drupal_client_ping($client, $system) { db_query("INSERT INTO {client_system} (cid, name, type) VALUES (%d, '%s', '%s')", $client['cid'], $item['name'], $item['type']); } } - watchdog('client ping', t('Ping from %name (%link).', array('%name' => $client['name'], '%link' => $client['link'])), WATCHDOG_NOTICE, '<a href="'. check_url($client['link']) .'">view</a>'); + watchdog('client ping', 'Ping from %name (%link).', array('%name' => $client['name'], '%link' => $client['link']), WATCHDOG_NOTICE, '<a href="'. check_url($client['link']) .'">view</a>'); return TRUE; } @@ -300,7 +300,7 @@ function drupal_notify($server) { $result = xmlrpc($server, 'drupal.client.ping', $client, $system); if ($result === FALSE) { - watchdog('server ping', t('Failed to notify %server; error code: %errno; error message: %error_msg.', array('%server' => $server, '%errno' => xmlrpc_errno(), '%error_msg' => xmlrpc_error_msg())), WATCHDOG_WARNING); + watchdog('server ping', 'Failed to notify %server; error code: %errno; error message: %error_msg.', array('%server' => $server, '%errno' => xmlrpc_errno(), '%error_msg' => xmlrpc_error_msg()), WATCHDOG_WARNING); } } diff --git a/modules/filter/filter.module b/modules/filter/filter.module index 93c3e7c1f..3b12f6371 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -819,7 +819,7 @@ function filter_form_validate($form) { } } form_error($form, t('An illegal choice has been detected. Please contact the site administrator.')); - watchdog('form', t('Illegal choice %choice in %name element.', array('%choice' => $form[$key]['#value'], '%name' => empty($form['#title']) ? $form['#parents'][0] : $form['#title'])), WATCHDOG_ERROR); + watchdog('form', 'Illegal choice %choice in %name element.', array('%choice' => $form[$key]['#value'], '%name' => empty($form['#title']) ? $form['#parents'][0] : $form['#title']), WATCHDOG_ERROR); } /** diff --git a/modules/forum/forum.module b/modules/forum/forum.module index ac6bb27cc..8cc65f98b 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -615,7 +615,7 @@ function forum_confirm_delete($tid) { function forum_confirm_delete_submit($form_id, $form_values) { taxonomy_del_term($form_values['tid']); drupal_set_message(t('The forum %term and all sub-forums and associated posts have been deleted.', array('%term' => $form_values['name']))); - watchdog('content', t('forum: deleted %term and all its sub-forums and associated posts.', array('%term' => $form_values['name']))); + watchdog('content', 'forum: deleted %term and all its sub-forums and associated posts.', array('%term' => $form_values['name'])); return 'admin/content/forum'; } diff --git a/modules/locale/locale.module b/modules/locale/locale.module index a3d0438d3..e8233ce0e 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -383,9 +383,9 @@ function locale_admin_manage_delete_form_submit($form_id, $form_values) { if (isset($languages[$form_values['langcode']])) { db_query("DELETE FROM {languages} WHERE language = '%s'", $form_values['langcode']); db_query("DELETE FROM {locales_target} WHERE language = '%s'", $form_values['langcode']); - $message = t('The language %locale has been removed.', array('%locale' => t($languages[$form_values['langcode']]->name))); - drupal_set_message($message); - watchdog('locale', $message); + $variables = array('%locale' => $languages[$form_values['langcode']]->name); + drupal_set_message(t('The language %locale has been removed.', $variables)); + watchdog('locale', 'The language %locale has been removed.', $variables); } // Changing the locale settings impacts the interface: diff --git a/modules/menu/menu.module b/modules/menu/menu.module index 944503919..0f97771ee 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -423,7 +423,7 @@ function menu_edit_item_save($edit) { else { db_query("INSERT INTO {menu_custom} (parent, path, title, description, weight, type, admin) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $parent, isset($edit['path']) ? $edit['path'] : $edit['original_path'], $edit['title'], $edit['description'], $edit['weight'], $edit['type'], isset($edit['path'])); } - watchdog('menu', t('Saved menu item %title.', $t_args), WATCHDOG_NOTICE, l(t('view'), 'admin/build/menu')); + watchdog('menu', 'Saved menu item %title.', $t_args, WATCHDOG_NOTICE, l(t('view'), 'admin/build/menu')); drupal_set_message(t('The menu item %title has been saved.', $t_args)); menu_rebuild(); } @@ -500,11 +500,11 @@ function menu_item_delete_form_submit($form_id, $form_values) { $t_args = array('%title' => $form_values['title']); if ($form_values['type'] & MENU_IS_ROOT) { drupal_set_message(t('The menu %title has been deleted.', $t_args)); - watchdog('menu', t('Deleted menu %title.', $t_args), WATCHDOG_NOTICE); + watchdog('menu', 'Deleted menu %title.', $t_args, WATCHDOG_NOTICE); } else { drupal_set_message(t('The menu item %title has been deleted.', $t_args)); - watchdog('menu', t('Deleted menu item %title.', $t_args), WATCHDOG_NOTICE); + watchdog('menu', 'Deleted menu item %title.', $t_args, WATCHDOG_NOTICE); } return 'admin/build/menu'; diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc index eef1589aa..ff19c9c70 100644 --- a/modules/node/content_types.inc +++ b/modules/node/content_types.inc @@ -333,7 +333,7 @@ function node_type_form_submit($form_id, $form_values) { } elseif ($status == SAVED_NEW) { drupal_set_message(t('The content type %name has been added.', $t_args)); - watchdog('node', t('Added content type %name.', $t_args), WATCHDOG_NOTICE, l(t('view'), 'admin/content/types')); + watchdog('node', 'Added content type %name.', $t_args, WATCHDOG_NOTICE, l(t('view'), 'admin/content/types')); } return 'admin/content/types'; @@ -401,7 +401,7 @@ function node_type_delete_confirm_submit($form_id, $form_values) { $t_args = array('%name' => $form_values['name']); drupal_set_message(t('The content type %name has been deleted.', $t_args)); - watchdog('menu', t('Deleted content type %name.', $t_args), WATCHDOG_NOTICE); + watchdog('menu', 'Deleted content type %name.', $t_args, WATCHDOG_NOTICE); node_types_rebuild(); menu_rebuild(); diff --git a/modules/node/node.module b/modules/node/node.module index 766325645..d178e53b2 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1724,7 +1724,7 @@ function node_revision_revert($nid, $revision) { node_save($node); drupal_set_message(t('%title has been reverted back to the revision from %revision-date', array('%revision-date' => format_date($node->revision_timestamp), '%title' => $node->title))); - watchdog('content', t('@type: reverted %title revision %revision.', array('@type' => t($node->type), '%title' => $node->title, '%revision' => $revision))); + watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node->type, '%title' => $node->title, '%revision' => $revision)); } else { drupal_set_message(t('You tried to revert to an invalid revision.'), 'error'); @@ -1749,7 +1749,7 @@ function node_revision_delete($nid, $revision) { db_query("DELETE FROM {node_revisions} WHERE nid = %d AND vid = %d", $nid, $revision); node_invoke_nodeapi($node, 'delete revision'); drupal_set_message(t('Deleted %title revision %revision.', array('%title' => $node->title, '%revision' => $revision))); - watchdog('content', t('@type: deleted %title revision %revision.', array('@type' => t($node->type), '%title' => $node->title, '%revision' => $revision))); + watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node->type, '%title' => $node->title, '%revision' => $revision)); } else { @@ -2286,12 +2286,12 @@ function node_form_submit($form_id, $form_values) { // Prepare the node's body: if ($node->nid) { node_save($node); - watchdog('content', t('@type: updated %title.', array('@type' => t($node->type), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid)); + watchdog('content', '@type: updated %title.', array('@type' => $node->type, '%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid)); drupal_set_message(t('The %post has been updated.', array('%post' => node_get_types('name', $node)))); } else { node_save($node); - watchdog('content', t('@type: added %title.', array('@type' => t($node->type), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid")); + watchdog('content', '@type: added %title.', array('@type' => $node->type, '%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid")); drupal_set_message(t('Your %post has been created.', array('%post' => node_get_types('name', $node)))); } if ($node->nid) { @@ -2353,7 +2353,7 @@ function node_delete($nid) { search_wipe($node->nid, 'node'); } drupal_set_message(t('%title has been deleted.', array('%title' => $node->title))); - watchdog('content', t('@type: deleted %title.', array('@type' => t($node->type), '%title' => $node->title))); + watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title)); } } diff --git a/modules/ping/ping.module b/modules/ping/ping.module index 85626d39b..025b5da17 100644 --- a/modules/ping/ping.module +++ b/modules/ping/ping.module @@ -52,7 +52,7 @@ function ping_ping($name = '', $url = '') { $result = xmlrpc('http://rpc.pingomatic.com', 'weblogUpdates.ping', $name, $url); if ($result === FALSE) { - watchdog('directory ping', t('Failed to notify pingomatic.com (site).'), WATCHDOG_WARNING); + watchdog('directory ping', 'Failed to notify pingomatic.com (site).', WATCHDOG_WARNING); } } diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 3c0faa55d..e023962ff 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -372,7 +372,7 @@ function profile_field_form_submit($form_id, $form_values) { db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, '%s', '%s')", $form_values['title'], $form_values['name'], $form_values['explanation'], $form_values['category'], $form_values['type'], $form_values['weight'], $form_values['required'], $form_values['register'], $form_values['visibility'], $form_values['autocomplete'], $form_values['options'], $form_values['page']); drupal_set_message(t('The field has been created.')); - watchdog('profile', t('Profile field %field added under category %category.', array('%field' => $form_values['title'], '%category' => $form_values['category'])), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile')); + watchdog('profile', 'Profile field %field added under category %category.', array('%field' => $form_values['title'], '%category' => $form_values['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile')); } else { db_query("UPDATE {profile_fields} SET title = '%s', name = '%s', explanation = '%s', category = '%s', weight = %d, required = %d, register = %d, visibility = %d, autocomplete = %d, options = '%s', page = '%s' WHERE fid = %d", $form_values['title'], $form_values['name'], $form_values['explanation'], $form_values['category'], $form_values['weight'], $form_values['required'], $form_values['register'], $form_values['visibility'], $form_values['autocomplete'], $form_values['options'], $form_values['page'], $form_values['fid']); @@ -413,7 +413,7 @@ function profile_field_delete_submit($form_id, $form_values) { cache_clear_all(); drupal_set_message(t('The field %field has been deleted.', array('%field' => $form_values['title']))); - watchdog('profile', t('Profile field %field deleted.', array('%field' => $form_values['title'])), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile')); + watchdog('profile', 'Profile field %field deleted.', array('%field' => $form_values['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile')); return 'admin/user/profile'; } diff --git a/modules/search/search.module b/modules/search/search.module index 93cfeb0e6..be06edcce 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -936,7 +936,7 @@ function search_view($type = 'node') { $results = ''; if (trim($keys)) { // Log the search keys: - watchdog('search', t('%keys (@type).', array('%keys' => $keys, '@type' => module_invoke($type, 'search', 'name'))), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys)); + watchdog('search', '%keys (@type).', array('%keys' => $keys, '@type' => module_invoke($type, 'search', 'name')), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys)); // Collect the search results: $results = search_data($keys, $type); diff --git a/modules/syslog/syslog.module b/modules/syslog/syslog.module index 747622697..76ee75e57 100644 --- a/modules/syslog/syslog.module +++ b/modules/syslog/syslog.module @@ -98,7 +98,8 @@ function theme_syslog_format($entry) { '@referer_uri' => $entry['referer'], '@uid' => $entry['user']->uid, '@link' => strip_tags($entry['link']), - '@message' => strip_tags($entry['message']), + // Keep message English, but replace variable components. + '@message' => strip_tags(strtr($entry['message'], $entry['variables'])), )); return $message; } diff --git a/modules/system/system.install b/modules/system/system.install index ab3bb09ba..334ff08c6 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2353,7 +2353,7 @@ function system_update_159() { } else { db_query('UPDATE {old_revisions} SET done = 1 WHERE nid = %d', $node->nid); - watchdog('php', "Recovering old revisions for node $node->nid failed.", WATCHDOG_WARNING); + watchdog('php', "Recovering old revisions for node %nid failed.", array('%nid' => $node->nid), WATCHDOG_WARNING); } } } @@ -2583,7 +2583,7 @@ function system_update_169() { $encoding = db_result(db_query('SHOW server_encoding')); if (!in_array(strtolower($encoding), array('unicode', 'utf8'))) { $msg = 'Your PostgreSQL database is set up with the wrong character encoding ('. $encoding .'). It is possible it will not work as expected. It is advised to recreate it with UTF-8/Unicode encoding. More information can be found in the <a href="http://www.postgresql.org/docs/7.4/interactive/multibyte.html">PostgreSQL documentation</a>.'; - watchdog('php', $msg, WATCHDOG_WARNING); + watchdog('php', $msg, array(), WATCHDOG_WARNING); drupal_set_message($msg, 'status'); } } @@ -3778,6 +3778,26 @@ function system_update_6009() { } /** + * Add variable replacement for watchdog messages. + */ +function system_update_6009() { + $ret = array(); + switch ($GLOBALS['db_type']) { + case 'pgsql': + db_add_column($ret, 'watchdog', 'variables', 'text', array('not null' => TRUE)); + break; + case 'mysql': + case 'mysqli': + $ret[] = update_sql("ALTER TABLE {watchdog} ADD variables longtext NOT NULL"); + break; + } + // Ensure we have 'N;' (serialize(NULL)) as the default, so existing + // log messages will not get translated in the new system. + $ret[] = update_sql("UPDATE {watchdog} SET variables = 'N;'"); + return $ret; +} + +/** * @} End of "defgroup updates-5.x-to-6.x" * The next series of updates should start at 7000. */ |