(bug 19447) Disable the localisation store backend during install and update.
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 3 Jul 2009 06:56:46 +0000 (06:56 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 3 Jul 2009 06:56:46 +0000 (06:56 +0000)
config/index.php
includes/AutoLoader.php
includes/LocalisationCache.php
maintenance/update.php

index c2a478b..c207069 100644 (file)
@@ -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" );
index aef9297..82743f3 100644 (file)
@@ -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',
index d5ad424..0974f4a 100644 (file)
@@ -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.
index 8816f94..6c52ef1 100644 (file)
 $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" );