Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2294,6 +2294,8 @@ |
2295 | 2295 | foreach ( (array) $modules as $name ) { |
2296 | 2296 | $moduleGroups[strpos( $name, 'user' ) === 0 ? 'user' : null][] = $name; |
2297 | 2297 | } |
| 2298 | + // Make sure ResourceLoader is ready for use |
| 2299 | + ResourceLoader::initialize(); |
2298 | 2300 | $links = ''; |
2299 | 2301 | foreach ( $moduleGroups as $group => $modules ) { |
2300 | 2302 | if ( count( $modules ) ) { |
Index: trunk/phase3/includes/ResourceLoader.php |
— | — | @@ -29,6 +29,7 @@ |
30 | 30 | |
31 | 31 | // @var array list of module name/ResourceLoaderModule object pairs |
32 | 32 | protected static $modules = array(); |
| 33 | + protected static $initialized = false; |
33 | 34 | |
34 | 35 | /* Protected Static Methods */ |
35 | 36 | |
— | — | @@ -84,6 +85,17 @@ |
85 | 86 | |
86 | 87 | /* Static Methods */ |
87 | 88 | |
| 89 | + public static function initialize() { |
| 90 | + global $IP; |
| 91 | + |
| 92 | + if ( !self::$initialized ) { |
| 93 | + // Do this first just in case someone accidentally adds a call to ResourceLoader::initialize in their hook |
| 94 | + self::$initialized = true; |
| 95 | + self::register( include( "$IP/resources/Resources.php" ) ); |
| 96 | + wfRunHooks( 'ResourceLoaderRegisterModules' ); |
| 97 | + } |
| 98 | + } |
| 99 | + |
88 | 100 | /** |
89 | 101 | * Registers a module with the ResourceLoader system. |
90 | 102 | * |
— | — | @@ -194,6 +206,9 @@ |
195 | 207 | global $wgResourceLoaderVersionedClientMaxage, $wgResourceLoaderVersionedServerMaxage; |
196 | 208 | global $wgResourceLoaderUnversionedServerMaxage, $wgResourceLoaderUnversionedClientMaxage; |
197 | 209 | |
| 210 | + // Register modules |
| 211 | + self::initialize(); |
| 212 | + |
198 | 213 | // Split requested modules into two groups, modules and missing |
199 | 214 | $modules = array(); |
200 | 215 | $missing = array(); |
— | — | @@ -323,7 +338,4 @@ |
324 | 339 | } |
325 | 340 | } |
326 | 341 | } |
327 | | -} |
328 | | - |
329 | | -ResourceLoader::register( include( "$IP/resources/Resources.php" ) ); |
330 | | -wfRunHooks( 'ResourceLoaderRegisterModules' ); |
\ No newline at end of file |
| 342 | +} |
\ No newline at end of file |