Merge "Add missing uploadstash.us_props for PostgreSQL"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderFileModule.php
index 8183999..eaff86f 100644 (file)
@@ -241,7 +241,11 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                                case 'dependencies':
                                case 'messages':
                                case 'targets':
-                                       $this->{$member} = (array)$option;
+                                       // Normalise
+                                       $option = array_values( array_unique( (array)$option ) );
+                                       sort( $option );
+
+                                       $this->{$member} = $option;
                                        break;
                                // Single strings
                                case 'group':
@@ -450,21 +454,57 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                // If a module is nothing but a list of dependencies, we need to avoid
                // giving max() an empty array
                if ( count( $files ) === 0 ) {
+                       $this->modifiedTime[$context->getHash()] = 1;
                        wfProfileOut( __METHOD__ );
-                       return $this->modifiedTime[$context->getHash()] = 1;
+                       return $this->modifiedTime[$context->getHash()];
                }
 
                wfProfileIn( __METHOD__ . '-filemtime' );
                $filesMtime = max( array_map( array( __CLASS__, 'safeFilemtime' ), $files ) );
                wfProfileOut( __METHOD__ . '-filemtime' );
+
                $this->modifiedTime[$context->getHash()] = max(
                        $filesMtime,
-                       $this->getMsgBlobMtime( $context->getLanguage() ) );
+                       $this->getMsgBlobMtime( $context->getLanguage() ),
+                       $this->getDefinitionMtime( $context )
+               );
 
                wfProfileOut( __METHOD__ );
                return $this->modifiedTime[$context->getHash()];
        }
 
+       /**
+        * Get the definition summary for this module.
+        *
+        * @return Array
+        */
+       public function getDefinitionSummary( ResourceLoaderContext $context ) {
+               $summary = array(
+                       'class' => get_class( $this ),
+               );
+               foreach ( array(
+                       'scripts',
+                       'debugScripts',
+                       'loaderScripts',
+                       'styles',
+                       'languageScripts',
+                       'skinScripts',
+                       'skinStyles',
+                       'dependencies',
+                       'messages',
+                       'targets',
+                       'group',
+                       'position',
+                       'localBasePath',
+                       'remoteBasePath',
+                       'debugRaw',
+                       'raw',
+               ) as $member ) {
+                       $summary[$member] = $this->{$member};
+               };
+               return $summary;
+       }
+
        /* Protected Methods */
 
        /**
@@ -538,8 +578,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                        return $list[$key];
                } elseif ( is_string( $fallback )
                        && isset( $list[$fallback] )
-                       && is_array( $list[$fallback] ) )
-               {
+                       && is_array( $list[$fallback] )
+               {
                        return $list[$fallback];
                }
                return array();