diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:31:04 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:58:39 +0200 |
commit | f6d65e533c62f6deb21342d4901ece24497b433e (patch) | |
tree | f28adf0362d14bcd448f7b65a7aaf38650f923aa /includes/resourceloader/ResourceLoaderUserGroupsModule.php | |
parent | c27b2e832fe25651ef2410fae85b41072aae7519 (diff) |
Update to MediaWiki 1.25.1
Diffstat (limited to 'includes/resourceloader/ResourceLoaderUserGroupsModule.php')
-rw-r--r-- | includes/resourceloader/ResourceLoaderUserGroupsModule.php | 26 |
1 files changed, 5 insertions, 21 deletions
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() { |