From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- maintenance/populateRevisionLength.php | 44 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'maintenance/populateRevisionLength.php') diff --git a/maintenance/populateRevisionLength.php b/maintenance/populateRevisionLength.php index d020b4cb..6626cbc1 100644 --- a/maintenance/populateRevisionLength.php +++ b/maintenance/populateRevisionLength.php @@ -1,5 +1,5 @@ mDescription = "Populates rev_len"; + $this->mDescription = "Populates the rev_len field"; $this->setBatchSize( 200 ); } - public function execute() { + protected function getUpdateKey() { + return 'populate rev_len'; + } + + protected function updateSkippedMessage() { + return 'rev_len column of revision table already populated.'; + } + + public function doDBUpdates() { $db = $this->getDB( DB_MASTER ); if ( !$db->tableExists( 'revision' ) ) { $this->error( "revision table does not exist", true ); } $this->output( "Populating rev_len column\n" ); - $start = $db->selectField( 'revision', 'MIN(rev_id)', false, __FUNCTION__ ); - $end = $db->selectField( 'revision', 'MAX(rev_id)', false, __FUNCTION__ ); - if ( is_null( $start ) || is_null( $end ) ) { + + $start = $db->selectField( 'revision', 'MIN(rev_id)', false, __METHOD__ ); + $end = $db->selectField( 'revision', 'MAX(rev_id)', false, __METHOD__ ); + if ( !$start || !$end ) { $this->output( "...revision table seems to be empty.\n" ); - $db->insert( 'updatelog', - array( 'ul_key' => 'populate rev_len' ), - __METHOD__, - 'IGNORE' ); - return; + return true; } + # Do remaining chunks $blockStart = intval( $start ); $blockEnd = intval( $start ) + $this->mBatchSize - 1; @@ -80,17 +86,9 @@ class PopulateRevisionLength extends Maintenance { $blockEnd += $this->mBatchSize; wfWaitForSlaves(); } - $logged = $db->insert( 'updatelog', - array( 'ul_key' => 'populate rev_len' ), - __METHOD__, - 'IGNORE' ); - if ( $logged ) { - $this->output( "rev_len population complete ... {$count} rows changed ({$missing} missing)\n" ); - return true; - } else { - $this->output( "Could not insert rev_len population row.\n" ); - return false; - } + + $this->output( "rev_len population complete ... {$count} rows changed ({$missing} missing)\n" ); + return true; } } -- cgit v1.2.2