From: Brion Vibber Date: Sat, 25 Jun 2005 23:57:49 +0000 (+0000) Subject: Clean abort if already upgraded. Wait if slaves 10 seconds behind. X-Git-Tag: 1.5.0beta1~16 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=bde1575c14b4474daf66b7e9f3d792e5758c622b;p=lhc%2Fweb%2Fwiklou.git Clean abort if already upgraded. Wait if slaves 10 seconds behind. --- diff --git a/UPGRADE b/UPGRADE index f0bafb2f5d..68d2220b26 100644 --- a/UPGRADE +++ b/UPGRADE @@ -30,8 +30,9 @@ explode, or leave your database half-done or otherwise badly hurting. Among other changes, note that Latin-1 encoding (ISO-8859-1) is no longer supported. Latin-1 wikis will need to be upgraded to -UTF-8, however the updater has not yet been updated to support -this automatically. +UTF-8; an experimental command-line upgrade helper script, +'upgrade1_5.php', can do this -- run it prior to 'update.php' or +the web upgrader. Message changes: * A number of additional UI messages have been chagned from HTML to diff --git a/maintenance/upgrade1_5.php b/maintenance/upgrade1_5.php index d86d0e9f88..ac7b8524e3 100644 --- a/maintenance/upgrade1_5.php +++ b/maintenance/upgrade1_5.php @@ -28,12 +28,15 @@ class FiveUpgrade { function FiveUpgrade() { global $wgDatabase; $this->conversionTables = $this->prepareWindows1252(); + $this->dbw =& $this->newConnection(); $this->dbr =& $this->newConnection(); $this->dbr->bufferResults( false ); - $this->cleanupSwaps = array(); + $this->slave =& wfGetDB( DB_SLAVE ); + $this->cleanupSwaps = array(); $this->emailAuth = false; # don't preauthenticate emails + $this->maxLag = 10; # if slaves are lagged more than 10 secs, wait } function doing( $step ) { @@ -250,6 +253,8 @@ class FiveUpgrade { * @access private */ function insertChunk( &$chunk ) { + // Give slaves a chance to catch up + wfWaitForSlaves( $this->maxLag ); $this->dbw->insert( $this->chunkTable, $chunk, $this->chunkFunction, $this->chunkOptions ); } @@ -323,7 +328,11 @@ class FiveUpgrade { $fname = "FiveUpgrade::upgradePage"; $chunksize = 100; - + if( $this->dbw->tableExists( 'page' ) ) { + $this->log( 'Page table already exists; aborting.' ); + die( -1 ); + } + $this->log( "Checking cur table for unique title index and applying if necessary" ); checkDupes( true );