From 371eb5b6e70e86d24bb3517b1291b229807b20dd Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 3 Jul 2009 06:56:46 +0000 Subject: [PATCH] (bug 19447) Disable the localisation store backend during install and update. --- config/index.php | 2 ++ includes/AutoLoader.php | 1 + includes/LocalisationCache.php | 20 ++++++++++++++++++++ maintenance/update.php | 5 +++++ 4 files changed, 28 insertions(+) diff --git a/config/index.php b/config/index.php index c2a478b495..c20706959a 100644 --- a/config/index.php +++ b/config/index.php @@ -831,6 +831,8 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { define( 'STDERR', fopen("php://stderr", "wb")); $wgUseDatabaseMessages = false; /* FIXME: For database failure */ require_once( "$IP/includes/Setup.php" ); + Language::getLocalisationCache()->disableBackend(); + chdir( "config" ); $wgTitle = Title::newFromText( "Installation script" ); diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index aef9297c11..82743f3963 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -117,6 +117,7 @@ $wgAutoloadLocalClasses = array( 'Job' => 'includes/JobQueue.php', 'LCStore_DB' => 'includes/LocalisationCache.php', 'LCStore_CDB' => 'includes/LocalisationCache.php', + 'LCStore_Null' => 'includes/LocalisationCache.php', 'License' => 'includes/Licenses.php', 'Licenses' => 'includes/Licenses.php', 'LinkBatch' => 'includes/LinkBatch.php', diff --git a/includes/LocalisationCache.php b/includes/LocalisationCache.php index d5ad4241de..0974f4ad92 100644 --- a/includes/LocalisationCache.php +++ b/includes/LocalisationCache.php @@ -648,6 +648,13 @@ class LocalisationCache { } } } + + /** + * Disable the storage backend + */ + public function disableBackend() { + $this->store = new LCStore_Null; + } } /** @@ -824,6 +831,19 @@ class LCStore_CDB implements LCStore { } } +/** + * Null store backend, used to avoid DB errors during install + */ +class LCStore_Null implements LCStore { + public function get( $code, $key ) { + return null; + } + + public function startWrite( $code ) {} + public function finishWrite() {} + public function set( $key, $value ) {} +} + /** * A localisation cache optimised for loading large amounts of data for many * languages. Used by rebuildLocalisationCache.php. diff --git a/maintenance/update.php b/maintenance/update.php index 8816f94331..6c52ef1bc3 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -13,6 +13,11 @@ $wgUseMasterForMaintenance = true; require( "commandLine.inc" ); require( "updaters.inc" ); + +# Don't try to load stuff from l10n_cache yet +$lc = Language::getLocalisationCache(); +$lc->disableBackend(); + $wgTitle = Title::newFromText( "MediaWiki database updater" ); echo( "MediaWiki {$wgVersion} Updater\n\n" ); -- 2.20.1