Merge "Localisation updates from http://translatewiki.net."
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderUserGroupsModule.php
index b5d96ca..9064263 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Resource loader module for user customizations.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -31,10 +33,13 @@ class ResourceLoaderUserGroupsModule extends ResourceLoaderWikiModule {
         * @return array
         */
        protected function getPages( ResourceLoaderContext $context ) {
-               global $wgUser;
+               global $wgUser, $wgUseSiteJs, $wgUseSiteCss;
 
                $userName = $context->getUser();
-               if ( !$userName ) {
+               if ( $userName === null ) {
+                       return array();
+               }
+               if ( !$wgUseSiteJs && !$wgUseSiteCss ) {
                        return array();
                }
 
@@ -49,12 +54,16 @@ class ResourceLoaderUserGroupsModule extends ResourceLoaderWikiModule {
                }
 
                $pages = array();
-               foreach( $user->getEffectiveGroups() as $group ) {
+               foreach ( $user->getEffectiveGroups() as $group ) {
                        if ( in_array( $group, array( '*', 'user' ) ) ) {
                                continue;
                        }
-                       $pages["MediaWiki:Group-$group.js"] = array( 'type' => 'script' );
-                       $pages["MediaWiki:Group-$group.css"] = array( 'type' => 'style' );
+                       if ( $wgUseSiteJs ) {
+                               $pages["MediaWiki:Group-$group.js"] = array( 'type' => 'script' );
+                       }
+                       if ( $wgUseSiteCss ) {
+                               $pages["MediaWiki:Group-$group.css"] = array( 'type' => 'style' );
+                       }
                }
                return $pages;
        }