Revert "Remove some remaining mentions of unstubbing from core"
authorAddshore <addshorewiki@gmail.com>
Thu, 5 Oct 2017 17:27:08 +0000 (17:27 +0000)
committerAddshore <addshorewiki@gmail.com>
Thu, 5 Oct 2017 17:27:08 +0000 (17:27 +0000)
This reverts commit 0f91e75c20e040f0e688fb05654ba7797afcff76.

Bug: T177478
Change-Id: I1937bd116d22479c38a9a34714c2090e2a4c0d7e

includes/OutputPage.php
includes/api/ApiBase.php
includes/cache/MessageCache.php
includes/parser/ParserOptions.php

index 785641d..5d9006a 100644 (file)
@@ -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();
index 9dd670a..80aeff5 100644 (file)
@@ -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
index 20cf64c..768f980 100644 (file)
@@ -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
index ee0da2a..c7146a1 100644 (file)
@@ -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 ) {