From ad136143c5de92257c4ad5459d3c39186fbf800a Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 10 Apr 2018 20:10:22 -0700 Subject: [PATCH] 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 --- includes/installer/DatabaseUpdater.php | 4 ++-- includes/installer/Installer.php | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) 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 -- 2.20.1