? watchdogfix.kpf
? watchdogfix.patch
? watchdogfix2.patch
? watchdogfix3.patch
? sites/localhost
Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.158
diff -u -p -r1.158 bootstrap.inc
--- includes/bootstrap.inc 24 Apr 2007 10:45:20 -0000 1.158
+++ includes/bootstrap.inc 24 Apr 2007 13:00:14 -0000
@@ -646,19 +646,26 @@ function request_uri() {
* @param $type
* The category to which this message belongs.
* @param $message
- * The message to store in the log.
+ * The message to store in the log. See t() for documentation
+ * on how $message and $variables interact. Keep $message
+ * translateable by not concatenating dynamic values into it!
+ * @param $variables
+ * Array of variables to replace in the message on display or
+ * NULL if message is already translated or not possible to
+ * translate.
* @param $severity
* The severity of the message, as per RFC 3164
* @param $link
* A link to associate with the message.
*/
-function watchdog($type, $message, $severity = WATCHDOG_NOTICE, $link = NULL) {
+function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {
global $user, $base_root;
// Prepare the fields to be logged
$log_message = array(
'type' => $type,
'message' => $message,
+ 'variables' => $variables,
'severity' => $severity,
'link' => $link,
'user' => $user,
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.632
diff -u -p -r1.632 common.inc
--- includes/common.inc 18 Apr 2007 20:35:45 -0000 1.632
+++ includes/common.inc 24 Apr 2007 13:00:16 -0000
@@ -332,7 +332,7 @@ function drupal_site_offline() {
function drupal_not_found() {
drupal_set_header('HTTP/1.1 404 Not Found');
- watchdog('page not found', check_plain($_GET['q']), WATCHDOG_WARNING);
+ watchdog('page not found', check_plain($_GET['q']), NULL, WATCHDOG_WARNING);
// Keep old path for reference
if (!isset($_REQUEST['destination'])) {
@@ -362,7 +362,7 @@ function drupal_not_found() {
*/
function drupal_access_denied() {
drupal_set_header('HTTP/1.1 403 Forbidden');
- watchdog('access denied', check_plain($_GET['q']), WATCHDOG_WARNING);
+ watchdog('access denied', check_plain($_GET['q']), NULL, WATCHDOG_WARNING);
// Keep old path for reference
if (!isset($_REQUEST['destination'])) {
@@ -556,7 +556,7 @@ function drupal_error_handler($errno, $m
drupal_set_message($entry, 'error');
}
- watchdog('php', t('%message in %file on line %line.', array('%error' => $types[$errno], '%message' => $message, '%file' => $filename, '%line' => $line)), WATCHDOG_ERROR);
+ watchdog('php', '%message in %file on line %line.', array('%error' => $types[$errno], '%message' => $message, '%file' => $filename, '%line' => $line), WATCHDOG_ERROR);
}
}
@@ -653,7 +653,7 @@ function fix_gpc_magic() {
* - %variable, which indicates that the string should be highlighted with
* theme_placeholder() which shows up by default as emphasized.
* @code
- * watchdog('mail', t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name)));
+ * $message = t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name));
* @endcode
*
* When using t(), try to put entire sentences and strings in one t() call.
@@ -2041,14 +2041,14 @@ function drupal_cron_run() {
if (time() - $semaphore > 3600) {
// Either cron has been running for more than an hour or the semaphore
// was not reset due to a database error.
- watchdog('cron', t('Cron has been running for more than an hour and is most likely stuck.'), WATCHDOG_ERROR);
+ watchdog('cron', 'Cron has been running for more than an hour and is most likely stuck.', array(), WATCHDOG_ERROR);
// Release cron semaphore
variable_del('cron_semaphore');
}
else {
// Cron is still running normally.
- watchdog('cron', t('Attempting to re-run cron while it is already running.'), WATCHDOG_WARNING);
+ watchdog('cron', 'Attempting to re-run cron while it is already running.', array(), WATCHDOG_WARNING);
}
}
else {
@@ -2063,7 +2063,7 @@ function drupal_cron_run() {
// Record cron time
variable_set('cron_last', time());
- watchdog('cron', t('Cron run completed.'), WATCHDOG_NOTICE);
+ watchdog('cron', 'Cron run completed.', array(), WATCHDOG_NOTICE);
// Release cron semaphore
variable_del('cron_semaphore');
@@ -2079,7 +2079,7 @@ function drupal_cron_run() {
function drupal_cron_cleanup() {
// See if the semaphore is still locked.
if (variable_get('cron_semaphore', FALSE)) {
- watchdog('cron', t('Cron run exceeded the time limit and was aborted.'), WATCHDOG_WARNING);
+ watchdog('cron', 'Cron run exceeded the time limit and was aborted.', array(), WATCHDOG_WARNING);
// Release cron semaphore
variable_del('cron_semaphore');
Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.96
diff -u -p -r1.96 file.inc
--- includes/file.inc 13 Apr 2007 08:56:57 -0000 1.96
+++ includes/file.inc 24 Apr 2007 13:00:17 -0000
@@ -107,7 +107,7 @@ function file_check_directory(&$director
}
else {
form_set_error($form_item, t('The directory %directory is not writable', array('%directory' => $directory)));
- watchdog('file system', t('The directory %directory is not writable, because it does not have the correct permissions set.', array('%directory' => $directory)), WATCHDOG_ERROR);
+ watchdog('file system', 'The directory %directory is not writable, because it does not have the correct permissions set.', array('%directory' => $directory), WATCHDOG_ERROR);
return FALSE;
}
}
@@ -119,9 +119,9 @@ function file_check_directory(&$director
chmod($directory .'/.htaccess', 0664);
}
else {
- $message = t("Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: !htaccess", array('%directory' => $directory, '!htaccess' => '
'. nl2br(check_plain($htaccess_lines))));
- form_set_error($form_item, $message);
- watchdog('security', $message, WATCHDOG_ERROR);
+ $variables = array('%directory' => $directory, '!htaccess' => '
'. nl2br(check_plain($htaccess_lines)));
+ form_set_error($form_item, t("Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: !htaccess", $variables));
+ watchdog('security', "Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: !htaccess", $variables, WATCHDOG_ERROR);
}
}
@@ -239,7 +239,7 @@ function file_check_upload($source = 'up
// This overcomes open_basedir restrictions for future file operations.
if (!move_uploaded_file($_FILES["files"]["tmp_name"][$source], $file->filepath)) {
drupal_set_message(t('File upload error. Could not move uploaded file.'));
- watchdog('file', t('Upload Error. Could not move uploaded file (%file) to destination (%destination).', array('%file' => $_FILES["files"]["tmp_name"][$source], '%destination' => $file->filepath)));
+ watchdog('file', 'Upload Error. Could not move uploaded file (%file) to destination (%destination).', array('%file' => $_FILES["files"]["tmp_name"][$source], '%destination' => $file->filepath));
return FALSE;
}
@@ -320,7 +320,7 @@ function file_copy(&$source, $dest = 0,
if ($basename === FALSE) {
$source = is_object($source) ? $source->filepath : $source;
drupal_set_message(t('The selected file %file could not be uploaded, because the destination %directory is not properly configured.', array('%file' => $source, '%directory' => $dest)), 'error');
- watchdog('file system', t('The selected file %file could not be uploaded, because the destination %directory could not be found, or because its permissions do not allow the file to be written.', array('%file' => $source, '%directory' => $dest)), WATCHDOG_ERROR);
+ watchdog('file system', 'The selected file %file could not be uploaded, because the destination %directory could not be found, or because its permissions do not allow the file to be written.', array('%file' => $source, '%directory' => $dest), WATCHDOG_ERROR);
return 0;
}
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.189
diff -u -p -r1.189 form.inc
--- includes/form.inc 23 Apr 2007 17:00:36 -0000 1.189
+++ includes/form.inc 24 Apr 2007 13:00:20 -0000
@@ -553,13 +553,13 @@ function _form_validate($elements, $form
foreach ($value as $v) {
if (!isset($options[$v])) {
form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.'));
- watchdog('form', t('Illegal choice %choice in !name element.', array('%choice' => $v, '!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'])), WATCHDOG_ERROR);
+ watchdog('form', 'Illegal choice %choice in !name element.', array('%choice' => $v, '!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR);
}
}
}
elseif (!isset($options[$elements['#value']])) {
form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.'));
- watchdog('form', t('Illegal choice %choice in %name element.', array('%choice' => $elements['#value'], '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'])), WATCHDOG_ERROR);
+ watchdog('form', 'Illegal choice %choice in %name element.', array('%choice' => $elements['#value'], '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR);
}
}
}
Index: includes/image.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/image.inc,v
retrieving revision 1.18
diff -u -p -r1.18 image.inc
--- includes/image.inc 13 Apr 2007 08:56:57 -0000 1.18
+++ includes/image.inc 24 Apr 2007 13:00:20 -0000
@@ -58,7 +58,7 @@ function image_toolkit_invoke($method, $
return call_user_func_array($function, $params);
}
else {
- watchdog('php', t("The selected image handling toolkit %toolkit can not correctly process %function.", array('%toolkit' => $toolkit, '%function' => $function)), WATCHDOG_ERROR);
+ watchdog('php', 'The selected image handling toolkit %toolkit can not correctly process %function.', array('%toolkit' => $toolkit, '%function' => $function), WATCHDOG_ERROR);
return FALSE;
}
}
Index: includes/locale.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/locale.inc,v
retrieving revision 1.117
diff -u -p -r1.117 locale.inc
--- includes/locale.inc 13 Apr 2007 08:56:57 -0000 1.117
+++ includes/locale.inc 24 Apr 2007 13:00:20 -0000
@@ -50,7 +50,7 @@ function _locale_add_language($code, $na
drupal_set_message(t('The language %language has been created.', array('%language' => t($name))));
}
- watchdog('locale', t('The %language language (%code) has been created.', array('%language' => t($name), '%code' => $code)));
+ watchdog('locale', 'The %language language (%code) has been created.', array('%language' => $name, '%code' => $code));
}
/**
@@ -457,9 +457,9 @@ function _locale_admin_import_submit($fo
// Now import strings into the language
if ($ret = _locale_import_po($file, $form_values['langcode'], $form_values['mode']) == FALSE) {
- $message = t('The translation import of %filename failed.', array('%filename' => $file->filename));
- drupal_set_message($message, 'error');
- watchdog('locale', $message, WATCHDOG_ERROR);
+ $variables = array('%filename' => $file->filename);
+ drupal_set_message(t('The translation import of %filename failed.', $variables), 'error');
+ watchdog('locale', 'The translation import of %filename failed.', $variables, WATCHDOG_ERROR);
}
}
else {
@@ -704,7 +704,7 @@ function _locale_import_po($file, $lang,
menu_rebuild();
drupal_set_message(t('The translation was successfully imported. There are %number newly created translated strings and %update strings were updated.', array('%number' => $additions, '%update' => $updates)));
- watchdog('locale', t('Imported %file into %locale: %number new strings added and %update updated.', array('%file' => $file->filename, '%locale' => $lang, '%number' => $additions, '%update' => $updates)));
+ watchdog('locale', 'Imported %file into %locale: %number new strings added and %update updated.', array('%file' => $file->filename, '%locale' => $lang, '%number' => $additions, '%update' => $updates));
return TRUE;
}
@@ -1353,7 +1353,7 @@ function _locale_export_po($language = N
$header .= "\"Plural-Forms: nplurals=". $meta->plurals ."; plural=". strtr($meta->formula, array('$' => '')) .";\\n\"\n";
}
$header .= "\n";
- watchdog('locale', t('Exported %locale translation file: %filename.', array('%locale' => $meta->name, '%filename' => $filename)));
+ watchdog('locale', 'Exported %locale translation file: %filename.', array('%locale' => $meta->name, '%filename' => $filename));
}
// Generating Portable Object Template
@@ -1374,7 +1374,7 @@ function _locale_export_po($language = N
$header .= "\"Content-Transfer-Encoding: 8bit\\n\"\n";
$header .= "\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n";
$header .= "\n";
- watchdog('locale', t('Exported translation file: %filename.', array('%filename' => $filename)));
+ watchdog('locale', 'Exported translation file: %filename.', array('%filename' => $filename));
}
// Start download process
Index: includes/unicode.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/unicode.inc,v
retrieving revision 1.23
diff -u -p -r1.23 unicode.inc
--- includes/unicode.inc 6 Dec 2006 16:15:52 -0000 1.23
+++ includes/unicode.inc 24 Apr 2007 13:00:21 -0000
@@ -148,7 +148,7 @@ function drupal_xml_parser_create(&$data
$data = ereg_replace('^(<\?xml[^>]+encoding)="([^"]+)"', '\\1="utf-8"', $out);
}
else {
- watchdog('php', t("Could not convert XML encoding %s to UTF-8.", array('%s' => $encoding)), WATCHDOG_WARNING);
+ watchdog('php', 'Could not convert XML encoding %s to UTF-8.', array('%s' => $encoding), WATCHDOG_WARNING);
return 0;
}
}
@@ -181,7 +181,7 @@ function drupal_convert_to_utf8($data, $
$out = @recode_string($encoding .'..utf-8', $data);
}
else {
- watchdog('php', t("Unsupported encoding %s. Please install iconv, GNU recode or mbstring for PHP.", array('%s' => $encoding)), WATCHDOG_ERROR);
+ watchdog('php', 'Unsupported encoding %s. Please install iconv, GNU recode or mbstring for PHP.', array('%s' => $encoding), WATCHDOG_ERROR);
return FALSE;
}
Index: modules/aggregator/aggregator.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v
retrieving revision 1.336
diff -u -p -r1.336 aggregator.module
--- modules/aggregator/aggregator.module 13 Apr 2007 08:56:57 -0000 1.336
+++ modules/aggregator/aggregator.module 24 Apr 2007 13:00:23 -0000
@@ -395,7 +395,7 @@ function aggregator_form_category_submit
}
}
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
}
}
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($fo
}
}
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($fo
}
}
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, $
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;
}
Index: modules/blogapi/blogapi.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v
retrieving revision 1.104
diff -u -p -r1.104 blogapi.module
--- modules/blogapi/blogapi.module 13 Apr 2007 08:56:57 -0000 1.104
+++ modules/blogapi/blogapi.module 24 Apr 2007 13:00:25 -0000
@@ -218,7 +218,7 @@ function blogapi_blogger_new_post($appke
$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($appk
$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;
}
Index: modules/book/book.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.module,v
retrieving revision 1.417
diff -u -p -r1.417 book.module
--- modules/book/book.module 13 Apr 2007 08:56:57 -0000 1.417
+++ modules/book/book.module 24 Apr 2007 13:00:25 -0000
@@ -939,7 +939,7 @@ function book_admin_edit_submit($form_id
$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));
}
}
Index: modules/contact/contact.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v
retrieving revision 1.80
diff -u -p -r1.80 contact.module
--- modules/contact/contact.module 13 Apr 2007 08:56:58 -0000 1.80
+++ modules/contact/contact.module 24 Apr 2007 13:00:25 -0000
@@ -243,13 +243,13 @@ function contact_admin_edit_submit($form
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 = NUL
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_
// 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_
// 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.'));
Index: modules/dblog/dblog.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.install,v
retrieving revision 1.1
diff -u -p -r1.1 dblog.install
--- modules/dblog/dblog.install 10 Apr 2007 10:10:27 -0000 1.1
+++ modules/dblog/dblog.install 24 Apr 2007 13:00:25 -0000
@@ -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 '',
Index: modules/dblog/dblog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v
retrieving revision 1.2
diff -u -p -r1.2 dblog.module
--- modules/dblog/dblog.module 13 Apr 2007 08:27:18 -0000 1.2
+++ modules/dblog/dblog.module 24 Apr 2007 13:00:25 -0000
@@ -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));
+ }
+}
Index: modules/drupal/drupal.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/drupal/drupal.module,v
retrieving revision 1.142
diff -u -p -r1.142 drupal.module
--- modules/drupal/drupal.module 13 Apr 2007 08:56:58 -0000 1.142
+++ modules/drupal/drupal.module 24 Apr 2007 13:00:26 -0000
@@ -205,7 +205,7 @@ function drupal_client_ping($client, $sy
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, 'view');
+ watchdog('client ping', 'Ping from %name (%link).', array('%name' => $client['name'], '%link' => $client['link']), WATCHDOG_NOTICE, 'view');
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);
}
}
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.170
diff -u -p -r1.170 filter.module
--- modules/filter/filter.module 24 Apr 2007 10:54:34 -0000 1.170
+++ modules/filter/filter.module 24 Apr 2007 13:00:27 -0000
@@ -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);
}
/**
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.393
diff -u -p -r1.393 forum.module
--- modules/forum/forum.module 13 Apr 2007 08:56:58 -0000 1.393
+++ modules/forum/forum.module 24 Apr 2007 13:00:29 -0000
@@ -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';
}
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.166
diff -u -p -r1.166 locale.module
--- modules/locale/locale.module 15 Apr 2007 15:36:10 -0000 1.166
+++ modules/locale/locale.module 24 Apr 2007 13:00:29 -0000
@@ -383,9 +383,9 @@ function locale_admin_manage_delete_form
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:
Index: modules/menu/menu.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v
retrieving revision 1.107
diff -u -p -r1.107 menu.module
--- modules/menu/menu.module 15 Apr 2007 14:38:16 -0000 1.107
+++ modules/menu/menu.module 24 Apr 2007 13:00:29 -0000
@@ -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($f
$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';
Index: modules/node/content_types.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v
retrieving revision 1.28
diff -u -p -r1.28 content_types.inc
--- modules/node/content_types.inc 13 Apr 2007 08:56:58 -0000 1.28
+++ modules/node/content_types.inc 24 Apr 2007 13:00:29 -0000
@@ -333,7 +333,7 @@ function node_type_form_submit($form_id,
}
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
$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();
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.803
diff -u -p -r1.803 node.module
--- modules/node/node.module 21 Apr 2007 18:10:53 -0000 1.803
+++ modules/node/node.module 24 Apr 2007 13:00:33 -0000
@@ -1724,7 +1724,7 @@ function node_revision_revert($nid, $rev
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, $rev
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, $for
// 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));
}
}
Index: modules/ping/ping.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/ping/ping.module,v
retrieving revision 1.45
diff -u -p -r1.45 ping.module
--- modules/ping/ping.module 21 Nov 2006 20:14:18 -0000 1.45
+++ modules/ping/ping.module 24 Apr 2007 13:00:33 -0000
@@ -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);
}
}
Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.198
diff -u -p -r1.198 profile.module
--- modules/profile/profile.module 23 Apr 2007 17:02:17 -0000 1.198
+++ modules/profile/profile.module 24 Apr 2007 13:00:33 -0000
@@ -372,7 +372,7 @@ function profile_field_form_submit($form
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($fo
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';
}
Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.218
diff -u -p -r1.218 search.module
--- modules/search/search.module 13 Apr 2007 08:56:59 -0000 1.218
+++ modules/search/search.module 24 Apr 2007 13:00:35 -0000
@@ -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);
Index: modules/syslog/syslog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/syslog/syslog.module,v
retrieving revision 1.3
diff -u -p -r1.3 syslog.module
--- modules/syslog/syslog.module 13 Apr 2007 08:27:18 -0000 1.3
+++ modules/syslog/syslog.module 24 Apr 2007 13:00:35 -0000
@@ -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;
}
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.95
diff -u -p -r1.95 system.install
--- modules/system/system.install 24 Apr 2007 10:54:35 -0000 1.95
+++ modules/system/system.install 24 Apr 2007 13:00:37 -0000
@@ -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 PostgreSQL documentation.';
- 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.
*/
Index: modules/throttle/throttle.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/throttle/throttle.module,v
retrieving revision 1.73
diff -u -p -r1.73 throttle.module
--- modules/throttle/throttle.module 24 Jan 2007 14:48:36 -0000 1.73
+++ modules/throttle/throttle.module 24 Apr 2007 13:00:37 -0000
@@ -106,7 +106,7 @@ function throttle_exit() {
}
if ($message) {
cache_clear_all();
- watchdog('throttle', t('Throttle') .': '. $message);
+ watchdog('throttle', 'Throttle: %message', array('%message' => $message));
}
}
}
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.774
diff -u -p -r1.774 user.module
--- modules/user/user.module 23 Apr 2007 17:07:57 -0000 1.774
+++ modules/user/user.module 24 Apr 2007 13:00:40 -0000
@@ -1070,7 +1070,7 @@ function user_login_validate($form_id, $
if (!$user->uid) {
form_set_error('name', t('Sorry, unrecognized username or password. Have you forgotten your password?', array('@password' => url('user/password'))));
- watchdog('user', t('Login attempt failed for %user.', array('%user' => $form_values['name'])));
+ watchdog('user', 'Login attempt failed for %user.', array('%user' => $form_values['name']));
}
}
}
@@ -1079,15 +1079,7 @@ function user_login_validate($form_id, $
function user_login_submit($form_id, $form_values) {
global $user;
if ($user->uid) {
- // To handle the edge case where this function is called during a
- // bootstrap, check for the existence of t().
- if (function_exists('t')) {
- $message = t('Session opened for %name.', array('%name' => $user->name));
- }
- else {
- $message = "Session opened for ". check_plain($user->name);
- }
- watchdog('user', $message);
+ watchdog('user', 'Session opened for %name.', array('%name' => $user->name));
// Update the user table timestamp noting user has logged in.
db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $user->uid);
@@ -1119,7 +1111,7 @@ function user_authenticate($name, $pass)
if ($server && ($result = user_get_authmaps("$name@$server"))) {
if (module_invoke(key($result), 'auth', $name, $pass, $server)) {
$user = user_external_load("$name@$server");
- watchdog('user', t('External load by %user using module %module.', array('%user' => $name .'@'. $server, '%module' => key($result))));
+ watchdog('user', 'External load by %user using module %module.', array('%user' => $name .'@'. $server, '%module' => key($result)));
}
}
@@ -1138,7 +1130,7 @@ function user_authenticate($name, $pass)
$userinfo["authname_$module"] = $name;
}
$user = user_save('', $userinfo);
- watchdog('user', t('New external user: %user using module %module.', array('%user' => $name, '%module' => $module)), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit'));
+ watchdog('user', 'New external user: %user using module %module.', array('%user' => $name, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit'));
break;
}
}
@@ -1153,7 +1145,7 @@ function user_authenticate($name, $pass)
function user_logout() {
global $user;
- watchdog('user', t('Session closed for %name.', array('%name' => $user->name)));
+ watchdog('user', 'Session closed for %name.', array('%name' => $user->name));
// Destroy the current session:
session_destroy();
@@ -1207,11 +1199,11 @@ function user_pass_submit($form_id, $for
$mail_success = drupal_mail('user-pass', $account->mail, $subject, $body, $from);
if ($mail_success) {
- watchdog('user', t('Password reset instructions mailed to %name at %email.', array('%name' => $account->name, '%email' => $account->mail)));
+ watchdog('user', 'Password reset instructions mailed to %name at %email.', array('%name' => $account->name, '%email' => $account->mail));
drupal_set_message(t('Further instructions have been sent to your e-mail address.'));
}
else {
- watchdog('user', t('Error mailing password reset instructions to %name at %email.', array('%name' => $account->name, '%email' => $account->mail)), WATCHDOG_ERROR);
+ watchdog('user', 'Error mailing password reset instructions to %name at %email.', array('%name' => $account->name, '%email' => $account->mail), WATCHDOG_ERROR);
drupal_set_message(t('Unable to send mail. Please contact the site admin.'));
}
return 'user';
@@ -1242,7 +1234,7 @@ function user_pass_reset($uid, $timestam
else if ($account->uid && $timestamp > $account->login && $timestamp < $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
// First stage is a confirmation form, then login
if ($action == 'login') {
- watchdog('user', t('User %name used one-time login link at time %timestamp.', array('%name' => $account->name, '%timestamp' => $timestamp)));
+ watchdog('user', 'User %name used one-time login link at time %timestamp.', array('%name' => $account->name, '%timestamp' => $timestamp));
// Update the user table noting user has logged in.
// And this also makes this hashed password a one-time-only login.
db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $account->uid);
@@ -1363,7 +1355,7 @@ function user_register_submit($form_id,
}
if (!$admin && array_intersect(array_keys($form_values), array('uid', 'roles', 'init', 'session', 'status'))) {
- watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING);
+ watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING);
return 'user/register';
}
//the unset below is needed to prevent these form values from being saved as user data
@@ -1375,7 +1367,7 @@ function user_register_submit($form_id,
$merge_data['status'] = variable_get('user_register', 1) == 1;
}
$account = user_save('', array_merge($form_values, $merge_data));
- watchdog('user', t('New user: %name %email.', array('%name' => $name, '%email' => '<'. $mail .'>')), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit'));
+ watchdog('user', 'New user: %name %email.', array('%name' => $name, '%email' => '<'. $mail .'>'), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit'));
$variables = array('!username' => $name, '!site' => variable_get('site_name', 'Drupal'), '!password' => $pass, '!uri' => $base_url, '!uri_brief' => substr($base_url, strlen('http://')), '!mailto' => $mail, '!date' => format_date(time()), '!login_uri' => url('user', array('absolute' => TRUE)), '!edit_uri' => url('user/'. $account->uid .'/edit', array('absolute' => TRUE)), '!login_url' => user_pass_reset_url($account));
@@ -1616,9 +1608,9 @@ function user_delete($edit, $uid) {
db_query('DELETE FROM {users} WHERE uid = %d', $uid);
db_query('DELETE FROM {users_roles} WHERE uid = %d', $uid);
db_query('DELETE FROM {authmap} WHERE uid = %d', $uid);
- $array = array('%name' => $account->name, '%email' => '<'. $account->mail .'>');
- watchdog('user', t('Deleted user: %name %email.', $array), WATCHDOG_NOTICE);
- drupal_set_message(t('%name has been deleted.', $array));
+ $variables = array('%name' => $account->name, '%email' => '<'. $account->mail .'>');
+ watchdog('user', 'Deleted user: %name %email.', $variables, WATCHDOG_NOTICE);
+ drupal_set_message(t('%name has been deleted.', $variables));
module_invoke_all('user', 'delete', $edit, $account);
}
@@ -1626,10 +1618,9 @@ function user_edit_validate($form_id, $f
user_module_invoke('validate', $form_values, $form_values['_account'], $form_values['_category']);
// Validate input to ensure that non-privileged users can't alter protected data.
if ((!user_access('administer users') && array_intersect(array_keys($form_values), array('uid', 'init', 'session'))) || (!user_access('administer access control') && isset($form_values['roles']))) {
- $message = t('Detected malicious attempt to alter protected user fields.');
- watchdog('security', $message, WATCHDOG_WARNING);
+ watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING);
// set this to a value type field
- form_set_error('category', $message);
+ form_set_error('category', t('Detected malicious attempt to alter protected user fields.'));
}
}
@@ -2340,7 +2331,7 @@ function user_user_operations() {
);
}
else {
- watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING);
+ watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING);
return;
}
}