r111920 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111919‎ | r111920 | r111921 >
Date:11:00, 20 February 2012
Author:aaron
Status:ok
Tags:
Comment:
r111795: Split out upgradeLegacyArchiveRow() function and added NS/title to condition. The $idCol var was misleading as obviously ar_timestamp is not unique.
Modified paths:
  • /trunk/phase3/maintenance/populateRevisionSha1.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/populateRevisionSha1.php
@@ -104,7 +104,7 @@
105105 $updateSize = 0;
106106 $db->begin();
107107 foreach ( $res as $row ) {
108 - if ( $this->upgradeRow( $row, 'archive', 'ar_timestamp', 'ar' ) ) {
 108+ if ( $this->upgradeLegacyArchiveRow( $row ) ) {
109109 ++$count;
110110 }
111111 if ( ++$updateSize >= 100 ) {
@@ -139,6 +139,31 @@
140140 return true;
141141 }
142142 }
 143+
 144+ protected function upgradeLegacyArchiveRow( $row ) {
 145+ $db = $this->getDB( DB_MASTER );
 146+ $rev = Revision::newFromArchiveRow( $row );
 147+ $text = $rev->getRawText();
 148+ if ( !is_string( $text ) ) {
 149+ # This should not happen, but sometimes does (bug 20757)
 150+ $this->output( "Text of revision with timestamp {$row->ar_timestamp} unavailable!\n" );
 151+ return false;
 152+ } else {
 153+ # Archive table as no PK, but (NS,title,time) should be near unique.
 154+ # Any duplicates on those should also have duplicated text anyway.
 155+ $db->update( 'archive',
 156+ array( 'ar_sha1' => Revision::base36Sha1( $text ) ),
 157+ array(
 158+ 'ar_namespace' => $row->ar_namespace,
 159+ 'ar_title' => $row->ar_title,
 160+ 'ar_timestamp' => $row->ar_timestamp,
 161+ 'ar_len' => $row->ar_len // extra sanity
 162+ ),
 163+ __METHOD__
 164+ );
 165+ return true;
 166+ }
 167+ }
143168 }
144169
145170 $maintClass = "PopulateRevisionSha1";

Sign-offs

UserFlagDate
Reedyinspected20:07, 6 March 2012

Follow-up revisions

RevisionCommit summaryAuthorDate
r113174MFT r111795, r111881, r111920, r112573, r112995, r113169reedy20:12, 6 March 2012
r113175MFT r111795, r111881, r111920, r112573, r112995, r113169reedy20:13, 6 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111795(bug 34373) - 'populateRevisionSha1.php misses archive rows, whose text is st...aaron21:48, 17 February 2012

Status & tagging log