r94363 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94362‎ | r94363 | r94364 >
Date:17:13, 12 August 2011
Author:aaron
Status:ok
Tags:
Comment:
Give notice about missing text
Modified paths:
  • /trunk/phase3/maintenance/populateRevisionSha1.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/populateRevisionSha1.php
@@ -26,7 +26,7 @@
2727 public function __construct() {
2828 parent::__construct();
2929 $this->mDescription = "Populates the rev_sha1 and ar_sha1 fields";
30 - $this->setBatchSize( 150 );
 30+ $this->setBatchSize( 200 );
3131 }
3232
3333 public function execute() {
@@ -78,10 +78,16 @@
7979 } else {
8080 $rev = new Revision( $row );
8181 }
82 - $db->update( $table,
83 - array( "{$prefix}_sha1" => Revision::base36Sha1( $rev->getRawText() ) ),
84 - array( $idCol => $row->$idCol ),
85 - __METHOD__ );
 82+ $text = $rev->getRawText();
 83+ if ( !is_string( $text ) ) {
 84+ # This should not happen, but sometimes does (bug 20757)
 85+ $this->output( "Text of revision {$row->$idCol} unavailable!\n" );
 86+ } else {
 87+ $db->update( $table,
 88+ array( "{$prefix}_sha1" => Revision::base36Sha1( $text ) ),
 89+ array( $idCol => $row->$idCol ),
 90+ __METHOD__ );
 91+ }
8692 }
8793 $db->commit();
8894

Status & tagging log