jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/382067 )
Change subject: Stop stubbing StubUserLang ...................................................................... Stop stubbing StubUserLang Stub objects are confusing as heck and are a performance optimization that really aren't fit for the modern era. They were designed to avoid loading the actual code from the disk back in the days when bytecode caching wasn't always gonna be there. It's 2017. If you're using HHVM, you've got a bytecode cache. If you're using any reasonably recent version of PHP then you've got the opcode caching enabled by default in basically every distro-related build. Nothing actually relies on this object being a stub (that'd be silly), so only references are basically things force unstubbing (also kind of silly) the object. Once remaining code referencing this in extensions are all cleaned up then we can remove the class itself. Change-Id: I15df24aeeb729e8e764792daa933377f35042fab --- M includes/Message.php M includes/Setup.php M includes/Status.php M includes/parser/CoreParserFunctions.php 4 files changed, 4 insertions(+), 9 deletions(-) Approvals: MaxSem: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/Message.php b/includes/Message.php index 0240fa7..d119940 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -732,8 +732,6 @@ 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 68e3d96..0be5c6e 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -811,7 +811,7 @@ /** * @var Language $wgLang */ -$wgLang = new StubUserLang; +$wgLang = RequestContext::getMain()->getLanguage(); // BackCompat /** * @var OutputPage $wgOut diff --git a/includes/Status.php b/includes/Status.php index a35af6e..5456ed0 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -153,12 +153,9 @@ * @return Language */ protected function languageFromParam( $lang ) { - global $wgLang; - if ( $lang === null ) { - // @todo: Use RequestContext::getMain()->getLanguage() instead - return $wgLang; - } elseif ( $lang instanceof Language || $lang instanceof StubUserLang ) { + return RequestContext::getMain()->getLanguage(); + } elseif ( $lang instanceof Language ) { return $lang; } else { return Language::factory( $lang ); diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 3d26262..bebf3f8 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -493,7 +493,7 @@ * * @param int|float $num * @param string $raw - * @param Language|StubUserLang $language + * @param Language $language * @return string */ public static function formatRaw( $num, $raw, $language ) { -- To view, visit https://gerrit.wikimedia.org/r/382067 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I15df24aeeb729e8e764792daa933377f35042fab Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Chad <ch...@wikimedia.org> Gerrit-Reviewer: C. Scott Ananian <canan...@wikimedia.org> Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: Zoranzoki21 <zorandori4...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits