From: Bryan Davis Date: Tue, 23 Feb 2016 17:43:01 +0000 (-0700) Subject: resourceloader: Remove $wgUser optimization that uses session X-Git-Tag: 1.31.0-rc.0~7858^2 X-Git-Url: http://git.cyclocoop.org/%24dirpuce/puce%24spip_lang_rtl.gif?a=commitdiff_plain;h=77e51f50e7ef8796fc6219e4d002fe8b3a56e14c;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index bf5ae4b647..6458e71e7e 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -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 }