From: Kunal Mehta Date: Wed, 11 Apr 2018 03:10:22 +0000 (-0700) Subject: Unbreak creating extension tables from the web installer X-Git-Tag: 1.31.0-rc.0~121^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=ad136143c5de92257c4ad5459d3c39186fbf800a;ds=sidebyside Unbreak creating extension tables from the web installer The web installer loads extensions during Installer::includeExtensions(), but then DatabaseUpdater::loadExtensions() reloads them again. Use a constant (MW_EXTENSIONS_LOADED) to indicate that we shouldn't load them again. Also fix a minor issue in loadExtensions() that would accidentally register a bogus yet harmless hook called 'wgHooks'. Change-Id: Id72fc0ceea15ccea52b1709bef51918ce64f8b40 --- diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 7a1aba636c..04132ad577 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -150,7 +150,7 @@ abstract class DatabaseUpdater { * LoadExtensionSchemaUpdates hook. */ private function loadExtensions() { - if ( !defined( 'MEDIAWIKI_INSTALL' ) ) { + if ( !defined( 'MEDIAWIKI_INSTALL' ) || defined( 'MW_EXTENSIONS_LOADED' ) ) { return; // already loaded } $vars = Installer::getExistingLocalSettings(); @@ -162,7 +162,7 @@ abstract class DatabaseUpdater { // This will automatically add "AutoloadClasses" to $wgAutoloadClasses $data = $registry->readFromQueue( $queue ); - $hooks = [ 'wgHooks' => [ 'LoadExtensionSchemaUpdates' => [] ] ]; + $hooks = []; if ( isset( $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ) ) { $hooks = $data['globals']['wgHooks']['LoadExtensionSchemaUpdates']; } diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 7cfc617333..94a5a5a474 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -1346,6 +1346,10 @@ abstract class Installer { $exts = $this->getVar( '_Extensions' ); $IP = $this->getVar( 'IP' ); + // Marker for DatabaseUpdater::loadExtensions so we don't + // double load extensions + define( 'MW_EXTENSIONS_LOADED', true ); + /** * We need to include DefaultSettings before including extensions to avoid * warnings about unset variables. However, the only thing we really