From: Kunal Mehta Date: Mon, 30 Mar 2015 21:35:45 +0000 (-0700) Subject: registration: Have wfLoadExtension() (and similar) use the queue X-Git-Tag: 1.31.0-rc.0~11926^2 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=78fbe31c2bce68cc355bf417314df299dc833162;p=lhc%2Fweb%2Fwiklou.git registration: Have wfLoadExtension() (and similar) use the queue Right now wfLoadExtension() and related functions explicitly load extensions immediately, bypassing the queue. This was done to be extremely backwards-compatible with the old require_once style of loading which does the same. However, for a future configuration database to work, we need to be able to reliably load extensions after configuration (LocalSettings.php) is loaded, which is currently at the top of Setup.php. Rather than doing this later, we should do this now to make sure the registration system will be able to handle it. In Wikimedia production, excentions are currently being loaded with direct calls to: ExtensionRegistry::getInstance()->queue(...); so we know that this should work, but that is not a nice API for sysadmins and developers to be entering into LocalSettings.php. If for some reason an extension really needs to be loaded immediately, they can still call: ExtensionRegistry::getInstance()->loadFromQueue(); But that should be the exception, not the norm. Change-Id: I72672e5c9541ede02d09f548c39ef6c8df0ec78a --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index a9ed60fe6e..bc3a46b394 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -166,12 +166,8 @@ if ( !function_exists( 'hash_equals' ) ) { /** * Load an extension * - * This is the closest equivalent to: - * require_once "$IP/extensions/$name/$name.php"; - * as it will process and load the extension immediately. - * - * However, batch loading with wfLoadExtensions will - * be more performant. + * This queues an extension to be loaded through + * the ExtensionRegistry system. * * @param string $name Name of the extension to load * @param string|null $path Absolute path of where to find the extension.json file @@ -181,7 +177,7 @@ function wfLoadExtension( $name, $path = null ) { global $IP; $path = "$IP/extensions/$name/extension.json"; } - ExtensionRegistry::getInstance()->load( $path ); + ExtensionRegistry::getInstance()->queue( $path ); } /** @@ -202,8 +198,6 @@ function wfLoadExtensions( array $exts ) { foreach ( $exts as $ext ) { $registry->queue( "$IP/extensions/$ext/extension.json" ); } - - $registry->loadFromQueue(); } /** @@ -218,7 +212,7 @@ function wfLoadSkin( $name, $path = null ) { global $IP; $path = "$IP/skins/$name/skin.json"; } - ExtensionRegistry::getInstance()->load( $path ); + ExtensionRegistry::getInstance()->queue( $path ); } /** @@ -233,8 +227,6 @@ function wfLoadSkins( array $skins ) { foreach ( $skins as $skin ) { $registry->queue( "$IP/skins/$skin/skin.json" ); } - - $registry->loadFromQueue(); } /**