From: Addshore Date: Thu, 5 Oct 2017 16:51:11 +0000 (+0000) Subject: Revert "Stop stubbing StubUserLang" X-Git-Tag: 1.31.0-rc.0~1864 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=c02d643d86b319cb755e0a97960efd16a9c2fd4e;p=lhc%2Fweb%2Fwiklou.git Revert "Stop stubbing StubUserLang" This reverts commit 7ab57ba290f670847f981d5fc2c79339f1d4844e. Bug: T177478 Change-Id: I28ac95ebcb64231a12c178165a0cb174e70f4e18 --- diff --git a/includes/Message.php b/includes/Message.php index d119940adf..0240fa7477 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -732,6 +732,8 @@ class Message implements MessageSpecifier, Serializable { 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 0be5c6e930..68e3d96afe 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -811,7 +811,7 @@ $wgUser = RequestContext::getMain()->getUser(); // BackCompat /** * @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 5456ed06e3..a35af6e8c6 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -153,9 +153,12 @@ class Status extends StatusValue { * @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 bebf3f8a0b..3d262628be 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -493,7 +493,7 @@ class CoreParserFunctions { * * @param int|float $num * @param string $raw - * @param Language $language + * @param Language|StubUserLang $language * @return string */ public static function formatRaw( $num, $raw, $language ) {