From: Addshore Date: Thu, 5 Oct 2017 17:27:08 +0000 (+0000) Subject: Revert "Remove some remaining mentions of unstubbing from core" X-Git-Tag: 1.31.0-rc.0~1862^2 X-Git-Url: http://git.cyclocoop.org/%22%20%20.%20generer_url_ecrire%28%22mots_tous%22%29%20.%20%22?a=commitdiff_plain;h=2781a0c1e03033dfb43359544b3d74bd91060d19;p=lhc%2Fweb%2Fwiklou.git Revert "Remove some remaining mentions of unstubbing from core" This reverts commit 0f91e75c20e040f0e688fb05654ba7797afcff76. Bug: T177478 Change-Id: I1937bd116d22479c38a9a34714c2090e2a4c0d7e --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 785641d1a6..5d9006a731 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1596,7 +1596,7 @@ class OutputPage extends ContextSource { if ( !$this->mParserOptions ) { if ( !$this->getContext()->getUser()->isSafeToLoad() ) { - // $wgUser isn't loaded yet, so don't try to get a + // $wgUser isn't unstubbable yet, so don't try to get a // ParserOptions for it. And don't cache this ParserOptions // either. $po = ParserOptions::newFromAnon(); diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 9dd670ac8c..80aeff5478 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1385,7 +1385,7 @@ abstract class ApiBase extends ContextSource { $limit2 = $limit2 ?: self::LIMIT_SML2; // This is a bit awkward, but we want to avoid calling canApiHighLimits() - // because it loads the user object + // because it unstubs $wgUser $valuesList = $this->explodeMultiValue( $value, $limit2 + 1 ); $sizeLimit = count( $valuesList ) > $limit1 && $this->mMainModule->canApiHighLimits() ? $limit2 diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 20cf64ce0c..768f980b26 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -187,7 +187,7 @@ class MessageCache { if ( !$this->mParserOptions ) { if ( !$wgUser->isSafeToLoad() ) { - // $wgUser isn't loaded yet, so don't try to get a + // $wgUser isn't unstubbable yet, so don't try to get a // ParserOptions for it. And don't cache this ParserOptions // either. $po = ParserOptions::newFromAnon(); @@ -874,7 +874,7 @@ class MessageCache { * the site language. * * @see MessageCache::get - * @param Language $lang Preferred language + * @param Language|StubObject $lang Preferred language * @param string $lckey Lowercase key for the message (as for localisation cache) * @param bool $useDB Whether to include messages from the wiki database * @return string|bool The message, or false if not found @@ -899,7 +899,7 @@ class MessageCache { * Given a language, try and fetch messages from that language and its fallbacks. * * @see MessageCache::get - * @param Language $lang Preferred language + * @param Language|StubObject $lang Preferred language * @param string $lckey Lowercase key for the message (as for localisation cache) * @param bool $useDB Whether to include messages from the wiki database * @param bool[] $alreadyTried Contains true for each language that has been tried already diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index ee0da2a3ef..c7146a1306 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -944,6 +944,9 @@ class ParserOptions { } if ( $lang === null ) { global $wgLang; + if ( !StubObject::isRealObject( $wgLang ) ) { + $wgLang->_unstub(); + } $lang = $wgLang; } $this->initialiseFromUser( $user, $lang ); @@ -1011,7 +1014,7 @@ class ParserOptions { * * @since 1.30 * @param User|null $user - * @param Language|null $lang + * @param Language|StubObject|null $lang * @return ParserOptions */ public static function newCanonical( User $user = null, $lang = null ) {