From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- .../ResourceLoaderUserGroupsModule.php | 26 +++++----------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'includes/resourceloader/ResourceLoaderUserGroupsModule.php') diff --git a/includes/resourceloader/ResourceLoaderUserGroupsModule.php b/includes/resourceloader/ResourceLoaderUserGroupsModule.php index 7cf19420..417cfced 100644 --- a/includes/resourceloader/ResourceLoaderUserGroupsModule.php +++ b/includes/resourceloader/ResourceLoaderUserGroupsModule.php @@ -25,39 +25,23 @@ */ class ResourceLoaderUserGroupsModule extends ResourceLoaderWikiModule { - /* Protected Members */ - protected $origin = self::ORIGIN_USER_SITEWIDE; protected $targets = array( 'desktop', 'mobile' ); - /* Protected Methods */ - /** * @param ResourceLoaderContext $context * @return array */ protected function getPages( ResourceLoaderContext $context ) { - global $wgUser; - - $userName = $context->getUser(); - if ( $userName === null ) { - return array(); - } - $useSiteJs = $this->getConfig()->get( 'UseSiteJs' ); $useSiteCss = $this->getConfig()->get( 'UseSiteCss' ); if ( !$useSiteJs && !$useSiteCss ) { return array(); } - // Use $wgUser is possible; allows to skip a lot of code - if ( is_object( $wgUser ) && $wgUser->getName() == $userName ) { - $user = $wgUser; - } else { - $user = User::newFromName( $userName ); - if ( !$user instanceof User ) { - return array(); - } + $user = $context->getUserObj(); + if ( !$user || $user->isAnon() ) { + return array(); } $pages = array(); @@ -75,9 +59,9 @@ class ResourceLoaderUserGroupsModule extends ResourceLoaderWikiModule { return $pages; } - /* Methods */ - /** + * Get group name + * * @return string */ public function getGroup() { -- cgit v1.2.3-54-g00ecf