From 40f792891839e83dacecd8d1dd3830bca2aca2cc Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 12 Aug 2011 17:13:28 +0000 Subject: [PATCH] Give notice about missing text --- maintenance/populateRevisionSha1.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/maintenance/populateRevisionSha1.php b/maintenance/populateRevisionSha1.php index 266b65acc4..ff19cd3adc 100644 --- a/maintenance/populateRevisionSha1.php +++ b/maintenance/populateRevisionSha1.php @@ -26,7 +26,7 @@ class PopulateRevisionSha1 extends Maintenance { public function __construct() { parent::__construct(); $this->mDescription = "Populates the rev_sha1 and ar_sha1 fields"; - $this->setBatchSize( 150 ); + $this->setBatchSize( 200 ); } public function execute() { @@ -78,10 +78,16 @@ class PopulateRevisionSha1 extends Maintenance { } else { $rev = new Revision( $row ); } - $db->update( $table, - array( "{$prefix}_sha1" => Revision::base36Sha1( $rev->getRawText() ) ), - array( $idCol => $row->$idCol ), - __METHOD__ ); + $text = $rev->getRawText(); + if ( !is_string( $text ) ) { + # This should not happen, but sometimes does (bug 20757) + $this->output( "Text of revision {$row->$idCol} unavailable!\n" ); + } else { + $db->update( $table, + array( "{$prefix}_sha1" => Revision::base36Sha1( $text ) ), + array( $idCol => $row->$idCol ), + __METHOD__ ); + } } $db->commit(); -- 2.20.1