From 926a83a07d6bf29965fd56008cb0df68c959e4ea Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 16 Jun 2015 22:14:10 +0100 Subject: [PATCH] resourceloader: Run ResourceLoaderRegisterModules after wgResourceModules We don't allow modifying existing modules or registering the same module twice. We do have an established convention of registering plugins for optional dependencies conditionally. E.g. - VisualEditor should only register 'uls.data' if ULS extension isn't installed. - The Math extension should only register its VE plugin if VE is installed. Typically the dependency being checked is registered unconditionally. The conditional one is the supplemental one in case the canonical source within the MediaWiki landscape is absent. Currently this means code will check both isModuleRegistered() and the global $wgResourceModules. This doesn't make sense. Reverse this so that the unconditional registry is processed first, and the programmatic one after. This also helps exceptions come from a more sensible place in case of a duplicate registration. Change-Id: Ib2d01c88511ade75a97b2509bccfabb1a4cc5c15 --- includes/resourceloader/ResourceLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 188643629d..83ee8f926b 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -283,8 +283,8 @@ class ResourceLoader implements LoggerAwareInterface { $this->register( include "$IP/resources/Resources.php" ); $this->register( include "$IP/resources/ResourcesOOUI.php" ); // Register extension modules - Hooks::run( 'ResourceLoaderRegisterModules', array( &$this ) ); $this->register( $config->get( 'ResourceModules' ) ); + Hooks::run( 'ResourceLoaderRegisterModules', array( &$this ) ); if ( $config->get( 'EnableJavaScriptTest' ) === true ) { $this->registerTestModules(); -- 2.20.1