resourceloader: Remove $wgUser optimization that uses session
authorBryan Davis <bd808@wikimedia.org>
Tue, 23 Feb 2016 17:43:01 +0000 (10:43 -0700)
committerKrinkle <krinklemail@gmail.com>
Tue, 23 Feb 2016 19:45:26 +0000 (19:45 +0000)
Remove optimization that avoids unstubbing $wgUser because $wgUser
is not a plain object for the current user name.

It's a stub with mFrom='session' until methods are called that need
the info, such as getName(), which then lazy loads the object based on
the session information.

We want to make load.php session-less.

Bug: T127233
Change-Id: Ica482e5d1892cb29456e6f2a91cd70017cf414c5

includes/resourceloader/ResourceLoaderContext.php

index bf5ae4b..6458e71 100644 (file)
@@ -221,13 +221,7 @@ class ResourceLoaderContext {
                if ( $this->userObj === null ) {
                        $username = $this->getUser();
                        if ( $username ) {
-                               // Optimize: Avoid loading a new User object if possible
-                               global $wgUser;
-                               if ( is_object( $wgUser ) && $wgUser->getName() === $username ) {
-                                       $this->userObj = $wgUser;
-                               } else {
-                                       $this->userObj = User::newFromName( $username );
-                               }
+                               $this->userObj = User::newFromName( $username );
                        } else {
                                $this->userObj = new User; // Anonymous user
                        }