Hello Chad, Krinkle, C. Scott Ananian, jenkins-bot, MaxSem, Jackmcbarn,
Zoranzoki21,
I'd like you to do a code review. Please visit
https://gerrit.wikimedia.org/r/382478
to review the following change.
Change subject: Revert "Stop stubbing StubUserLang"
......................................................................
Revert "Stop stubbing StubUserLang"
This reverts commit 7ab57ba290f670847f981d5fc2c79339f1d4844e.
Bug: T177478
Change-Id: I28ac95ebcb64231a12c178165a0cb174e70f4e18
---
M includes/Message.php
M includes/Setup.php
M includes/Status.php
M includes/parser/CoreParserFunctions.php
4 files changed, 9 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/78/382478/1
diff --git a/includes/Message.php b/includes/Message.php
index d119940..0240fa7 100644
--- a/includes/Message.php
+++ b/includes/Message.php
@@ -732,6 +732,8 @@
if ( !$this->language instanceof Language ||
$this->language->getCode() != $lang ) {
$this->language = Language::factory( $lang );
}
+ } elseif ( $lang instanceof StubUserLang ) {
+ $this->language = false;
} else {
$type = gettype( $lang );
throw new MWException( __METHOD__ . " must be "
diff --git a/includes/Setup.php b/includes/Setup.php
index 0be5c6e..68e3d96 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -811,7 +811,7 @@
/**
* @var Language $wgLang
*/
-$wgLang = RequestContext::getMain()->getLanguage(); // BackCompat
+$wgLang = new StubUserLang;
/**
* @var OutputPage $wgOut
diff --git a/includes/Status.php b/includes/Status.php
index 5456ed0..a35af6e 100644
--- a/includes/Status.php
+++ b/includes/Status.php
@@ -153,9 +153,12 @@
* @return Language
*/
protected function languageFromParam( $lang ) {
+ global $wgLang;
+
if ( $lang === null ) {
- return RequestContext::getMain()->getLanguage();
- } elseif ( $lang instanceof Language ) {
+ // @todo: Use RequestContext::getMain()->getLanguage()
instead
+ return $wgLang;
+ } elseif ( $lang instanceof Language || $lang instanceof
StubUserLang ) {
return $lang;
} else {
return Language::factory( $lang );
diff --git a/includes/parser/CoreParserFunctions.php
b/includes/parser/CoreParserFunctions.php
index bebf3f8..3d26262 100644
--- a/includes/parser/CoreParserFunctions.php
+++ b/includes/parser/CoreParserFunctions.php
@@ -493,7 +493,7 @@
*
* @param int|float $num
* @param string $raw
- * @param Language $language
+ * @param Language|StubUserLang $language
* @return string
*/
public static function formatRaw( $num, $raw, $language ) {
--
To view, visit https://gerrit.wikimedia.org/r/382478
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I28ac95ebcb64231a12c178165a0cb174e70f4e18
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: C. Scott Ananian <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Jackmcbarn <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Zoranzoki21 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits