Index: trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php |
— | — | @@ -29,27 +29,60 @@ |
30 | 30 | |
31 | 31 | /* Protected Members */ |
32 | 32 | |
33 | | - /** @var {array} List of paths to JavaScript files to always include */ |
| 33 | + /** |
| 34 | + * @var {array} List of paths to JavaScript files to always include |
| 35 | + * @format array( [file-path], [file-path], ... ) |
| 36 | + */ |
34 | 37 | protected $scripts = array(); |
35 | | - /** @var {array} List of paths to JavaScript files to include when using specific languages */ |
| 38 | + /** |
| 39 | + * @var {array} List of JavaScript files to include when using a specific language |
| 40 | + * @format array( [language-code] => array( [file-path], [file-path], ... ), ... ) |
| 41 | + */ |
36 | 42 | protected $languageScripts = array(); |
37 | | - /** @var {array} List of paths to JavaScript files to include when using specific skins */ |
| 43 | + /** |
| 44 | + * @var {array} List of JavaScript files to include when using a specific skin |
| 45 | + * @format array( [skin-name] => array( [file-path], [file-path], ... ), ... ) |
| 46 | + */ |
38 | 47 | protected $skinScripts = array(); |
39 | | - /** @var {array} List of paths to JavaScript files to include in debug mode */ |
| 48 | + /** |
| 49 | + * @var {array} List of paths to JavaScript files to include in debug mode |
| 50 | + * @format array( [skin-name] => array( [file-path], [file-path], ... ), ... ) |
| 51 | + */ |
40 | 52 | protected $debugScripts = array(); |
41 | | - /** @var {array} List of paths to JavaScript files to include in the startup module */ |
| 53 | + /** |
| 54 | + * @var {array} List of paths to JavaScript files to include in the startup module |
| 55 | + * @format array( [file-path], [file-path], ... ) |
| 56 | + */ |
42 | 57 | protected $loaderScripts = array(); |
43 | | - /** @var {array} List of paths to CSS files to always include */ |
| 58 | + /** |
| 59 | + * @var {array} List of paths to CSS files to always include |
| 60 | + * @format array( [file-path], [file-path], ... ) |
| 61 | + */ |
44 | 62 | protected $styles = array(); |
45 | | - /** @var {array} List of paths to CSS files to include when using specific skins */ |
| 63 | + /** |
| 64 | + * @var {array} List of paths to CSS files to include when using specific skins |
| 65 | + * @format array( [file-path], [file-path], ... ) |
| 66 | + */ |
46 | 67 | protected $skinStyles = array(); |
47 | | - /** @var {array} List of modules this module depends on */ |
| 68 | + /** |
| 69 | + * @var {array} List of modules this module depends on |
| 70 | + * @format array( [file-path], [file-path], ... ) |
| 71 | + */ |
48 | 72 | protected $dependencies = array(); |
49 | | - /** @var {array} List of message keys used by this module */ |
| 73 | + /** |
| 74 | + * @var {array} List of message keys used by this module |
| 75 | + * @format array( [module-name], [module-name], ... ) |
| 76 | + */ |
50 | 77 | protected $messages = array(); |
51 | | - /** @var {array} Name of group this module should be loaded in */ |
| 78 | + /** |
| 79 | + * @var {string} Name of group this module should be loaded in |
| 80 | + * @format array( [message-key], [message-key], ... ) |
| 81 | + */ |
52 | 82 | protected $group; |
53 | | - /** @var {array} Cache for mtime */ |
| 83 | + /** |
| 84 | + * @var {array} Cache for mtime |
| 85 | + * @format array( [hash] => [mtime], [hash] => [mtime], ... ) |
| 86 | + */ |
54 | 87 | protected $modifiedTime = array(); |
55 | 88 | |
56 | 89 | /* Methods */ |
— | — | @@ -253,6 +286,11 @@ |
254 | 287 | $this->getFileDependencies( $context->getSkin() ) |
255 | 288 | ); |
256 | 289 | |
| 290 | + // If a module is nothing but a list of dependencies, we need to avoid giving max() an empty array |
| 291 | + if ( count( $files ) === 0 ) { |
| 292 | + return $this->modifiedTime[$context->getHash()] = 1; |
| 293 | + } |
| 294 | + |
257 | 295 | wfProfileIn( __METHOD__.'-filemtime' ); |
258 | 296 | $filesMtime = max( array_map( 'filemtime', array_map( array( __CLASS__, 'resolveFilePath' ), $files ) ) ); |
259 | 297 | wfProfileOut( __METHOD__.'-filemtime' ); |
— | — | @@ -301,11 +339,11 @@ |
302 | 340 | $collatedFiles[$default][] = $value; |
303 | 341 | } else if ( is_array( $value ) ) { |
304 | 342 | // File name as the key, options array as the value |
305 | | - $media = isset( $value[$option] ) ? $value[$option] : $default; |
306 | | - if ( !isset( $collatedFiles[$media] ) ) { |
307 | | - $collatedFiles[$media] = array(); |
| 343 | + $optionValue = isset( $value[$option] ) ? $value[$option] : $default; |
| 344 | + if ( !isset( $collatedFiles[$optionValue] ) ) { |
| 345 | + $collatedFiles[$optionValue] = array(); |
308 | 346 | } |
309 | | - $collatedFiles[$media][] = $key; |
| 347 | + $collatedFiles[$optionValue][] = $key; |
310 | 348 | } |
311 | 349 | } |
312 | 350 | return $collatedFiles; |