foreach ( (array) $modules as $name ) {
$moduleGroups[strpos( $name, 'user' ) === 0 ? 'user' : null][] = $name;
}
+ // Make sure ResourceLoader is ready for use
+ ResourceLoader::initialize();
$links = '';
foreach ( $moduleGroups as $group => $modules ) {
if ( count( $modules ) ) {
// @var array list of module name/ResourceLoaderModule object pairs
protected static $modules = array();
+ protected static $initialized = false;
/* Protected Static Methods */
/* Static Methods */
+ public static function initialize() {
+ global $IP;
+
+ if ( !self::$initialized ) {
+ // Do this first just in case someone accidentally adds a call to ResourceLoader::initialize in their hook
+ self::$initialized = true;
+ self::register( include( "$IP/resources/Resources.php" ) );
+ wfRunHooks( 'ResourceLoaderRegisterModules' );
+ }
+ }
+
/**
* Registers a module with the ResourceLoader system.
*
global $wgResourceLoaderVersionedClientMaxage, $wgResourceLoaderVersionedServerMaxage;
global $wgResourceLoaderUnversionedServerMaxage, $wgResourceLoaderUnversionedClientMaxage;
+ // Register modules
+ self::initialize();
+
// Split requested modules into two groups, modules and missing
$modules = array();
$missing = array();
}
}
}
-}
-
-ResourceLoader::register( include( "$IP/resources/Resources.php" ) );
-wfRunHooks( 'ResourceLoaderRegisterModules' );
\ No newline at end of file
+}
\ No newline at end of file