r71163 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71162‎ | r71163 | r71164 >
Date:14:23, 16 August 2010
Author:demon
Status:ok
Tags:
Comment:
Add a post-update maintenance script list, moved deleteDefaultMessages into it.
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/installer/DatabaseUpdater.php (modified) (history)
  • /trunk/phase3/maintenance/deleteDefaultMessages.php (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/updaters.inc
@@ -876,7 +876,7 @@
877877 function do_stats_init() {
878878 // Sometimes site_stats table is not properly populated.
879879 global $wgDatabase;
880 - wfOut( "Checking site_stats row..." );
 880+ wfOut( "\nChecking site_stats row..." );
881881 $row = $wgDatabase->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ );
882882 if ( $row === false ) {
883883 wfOut( "data is missing! rebuilding...\n" );
@@ -915,7 +915,7 @@
916916 }
917917
918918 function do_all_updates( $shared = false, $purge = true ) {
919 - global $wgSharedDB, $wgSharedTables, $wgDatabase, $wgDBtype;
 919+ global $wgDatabase, $wgDBtype;
920920
921921 $updater = DatabaseUpdater::newForDb( $wgDatabase, $shared );
922922
@@ -923,18 +923,18 @@
924924
925925 $updater->doUpdates();
926926
 927+ if ( !defined( 'MW_NO_SETUP' ) ) {
 928+ define( 'MW_NO_SETUP', true );
 929+ }
 930+
 931+ foreach( $updater->getPostDatabaseUpdateMaintenance() as $maint ) {
 932+ call_user_func_array( array( new $maint, 'execute' ), array() );
 933+ }
 934+
927935 if ( $wgDBtype === 'postgres' ) {
928936 return;
929937 }
930938
931 - wfOut( "Deleting old default messages (this may take a long time!)..." );
932 - if ( !defined( 'MW_NO_SETUP' ) ) {
933 - define( 'MW_NO_SETUP', true );
934 - }
935 - require_once 'deleteDefaultMessages.php';
936 - DeleteDefaultMessages::reallyExecute();
937 - wfOut( "Done\n" );
938 -
939939 do_stats_init();
940940
941941 if ( $purge ) {
Index: trunk/phase3/maintenance/deleteDefaultMessages.php
@@ -31,10 +31,9 @@
3232 }
3333
3434 public function execute() {
35 - self::reallyExecute();
36 - }
37 -
38 - public static function reallyExecute() {
 35+
 36+ $this->output( 'Deleting old default messages (this may take a long time!)...', 'msg' );
 37+
3938 $user = 'MediaWiki default';
4039 $reason = 'No longer required';
4140
@@ -65,6 +64,8 @@
6665 $article->doDeleteArticle( $reason );
6766 $dbw->commit();
6867 }
 68+
 69+ $this->output( 'done!', 'msg' );
6970 }
7071 }
7172
Index: trunk/phase3/includes/installer/DatabaseUpdater.php
@@ -20,6 +20,10 @@
2121
2222 protected $shared = false;
2323
 24+ protected $postDatabaseUpdateMaintenance = array(
 25+ 'DeleteDefaultMessages'
 26+ );
 27+
2428 protected function __construct( $db, $shared ) {
2529 $this->db = $db;
2630 $this->shared = $shared;
@@ -37,6 +41,10 @@
3842
3943 public function getDB() { return $this->db; }
4044
 45+ public function getPostDatabaseUpdateMaintenance() {
 46+ return $this->postDatabaseUpdateMaintenance;
 47+ }
 48+
4149 public function doUpdates() {
4250 global $IP, $wgVersion;
4351 require_once( "$IP/maintenance/updaters.inc" );
Index: trunk/phase3/includes/AutoLoader.php
@@ -668,6 +668,7 @@
669669 'DbTestRecorder' => 'maintenance/parserTests.inc',
670670 'DeleteArchivedFilesImplementation' => 'maintenance/deleteArchivedFiles.inc',
671671 'DeleteArchivedRevisionsImplementation' => 'maintenance/deleteArchivedRevisions.inc',
 672+ 'DeleteDefaultMessages' => 'maintenance/deleteDefaultMessages.php',
672673 'DummyTermColorer' => 'maintenance/parserTests.inc',
673674 'ParserTest' => 'maintenance/parserTests.inc',
674675 'ParserTestParserHook' => 'maintenance/parserTestsParserHook.php',

Status & tagging log