Tim Starling has submitted this change and it was merged.
Change subject: (bug 44111) ErrorPageError log messages should be in English
......................................................................
(bug 44111) ErrorPageError log messages should be in English
We want log messages to be in English. ErrorPageError, however, will log
the messages using the language of the current user. This isn't often
noticed, because the normal page view code path doesn't log
ErrorPageError and the API doesn't usually have ErrorPageError thrown in
the first place.
The fix is simple enough: in the constructor, create a new Message
object and call ->inLanguage( 'en' ) on it. And, for good measure,
->useDatabase( false ) so customizations on the local wiki won't show up
in the log files either.
Since ErrorPageError already overrides report(), that will take care of
still showing the expected language to the end user.
Bug: 44111
Change-Id: I9a6ab43d63e76fa9708b62e32ddc3262aff282f7
---
M includes/Exception.php
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
Tim Starling: Verified; Looks good to me, approved
diff --git a/includes/Exception.php b/includes/Exception.php
index 7d9f63d..dc34320 100644
--- a/includes/Exception.php
+++ b/includes/Exception.php
@@ -328,11 +328,17 @@
$this->msg = $msg;
$this->params = $params;
+ // Bug 44111: Messages in the log files should be in English
and not
+ // customized by the local wiki. So get the default English
version for
+ // passing to the parent constructor. Our overridden report()
below
+ // makes sure that the page shown to the user is not forced to
English.
if( $msg instanceof Message ) {
- parent::__construct( $msg );
+ $enMsg = clone( $msg );
} else {
- parent::__construct( wfMessage( $msg )->text() );
+ $enMsg = wfMessage( $msg, $params );
}
+ $enMsg->inLanguage( 'en' )->useDatabase( false );
+ parent::__construct( $enMsg->text() );
}
function report() {
--
To view, visit https://gerrit.wikimedia.org/r/53191
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9a6ab43d63e76fa9708b62e32ddc3262aff282f7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits