resourceloader: Remove $wgUser optimization that uses session

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
This commit is contained in:
Bryan Davis 2016-02-23 10:43:01 -07:00 committed by Krinkle
parent 0e19c04838
commit 77e51f50e7

View 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
}