r52730 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52729‎ | r52730 | r52731 >
Date:06:56, 3 July 2009
Author:tstarling
Status:ok
Tags:
Comment:
(bug 19447) Disable the localisation store backend during install and update.
Modified paths:
  • /trunk/phase3/config/index.php (modified) (history)
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/LocalisationCache.php (modified) (history)
  • /trunk/phase3/maintenance/update.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/update.php
@@ -13,6 +13,11 @@
1414 $wgUseMasterForMaintenance = true;
1515 require( "commandLine.inc" );
1616 require( "updaters.inc" );
 17+
 18+# Don't try to load stuff from l10n_cache yet
 19+$lc = Language::getLocalisationCache();
 20+$lc->disableBackend();
 21+
1722 $wgTitle = Title::newFromText( "MediaWiki database updater" );
1823
1924 echo( "MediaWiki {$wgVersion} Updater\n\n" );
Index: trunk/phase3/includes/LocalisationCache.php
@@ -648,6 +648,13 @@
649649 }
650650 }
651651 }
 652+
 653+ /**
 654+ * Disable the storage backend
 655+ */
 656+ public function disableBackend() {
 657+ $this->store = new LCStore_Null;
 658+ }
652659 }
653660
654661 /**
@@ -825,6 +832,19 @@
826833 }
827834
828835 /**
 836+ * Null store backend, used to avoid DB errors during install
 837+ */
 838+class LCStore_Null implements LCStore {
 839+ public function get( $code, $key ) {
 840+ return null;
 841+ }
 842+
 843+ public function startWrite( $code ) {}
 844+ public function finishWrite() {}
 845+ public function set( $key, $value ) {}
 846+}
 847+
 848+/**
829849 * A localisation cache optimised for loading large amounts of data for many
830850 * languages. Used by rebuildLocalisationCache.php.
831851 */
Index: trunk/phase3/includes/AutoLoader.php
@@ -117,6 +117,7 @@
118118 'Job' => 'includes/JobQueue.php',
119119 'LCStore_DB' => 'includes/LocalisationCache.php',
120120 'LCStore_CDB' => 'includes/LocalisationCache.php',
 121+ 'LCStore_Null' => 'includes/LocalisationCache.php',
121122 'License' => 'includes/Licenses.php',
122123 'Licenses' => 'includes/Licenses.php',
123124 'LinkBatch' => 'includes/LinkBatch.php',
Index: trunk/phase3/config/index.php
@@ -831,6 +831,8 @@
832832 define( 'STDERR', fopen("php://stderr", "wb"));
833833 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
834834 require_once( "$IP/includes/Setup.php" );
 835+ Language::getLocalisationCache()->disableBackend();
 836+
835837 chdir( "config" );
836838
837839 $wgTitle = Title::newFromText( "Installation script" );

Follow-up revisions

RevisionCommit summaryAuthorDate
r53040access page and index namespaces through functions (bug 19447)thomasv10:55, 10 July 2009

Status & tagging log