From: Aaron Schulz Date: Sat, 26 May 2012 20:27:38 +0000 (-0700) Subject: Handle more ES exceptions when getting text. X-Git-Tag: 1.31.0-rc.0~23474 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=8241670132edf99e105ff133fcfb4f415955aecb;p=lhc%2Fweb%2Fwiklou.git Handle more ES exceptions when getting text. Change-Id: I795dce37bcf4a24d5922d2d5166bf27ba9b77607 --- diff --git a/maintenance/populateRevisionSha1.php b/maintenance/populateRevisionSha1.php index d8ff74906c..1d8e4c8ba6 100644 --- a/maintenance/populateRevisionSha1.php +++ b/maintenance/populateRevisionSha1.php @@ -132,12 +132,15 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { */ protected function upgradeRow( $row, $table, $idCol, $prefix ) { $db = $this->getDB( DB_MASTER ); - if ( $table === 'archive' ) { - $rev = Revision::newFromArchiveRow( $row ); - } else { - $rev = new Revision( $row ); + try { + $rev = ( $table === 'archive' ) + ? Revision::newFromArchiveRow( $row ) + : new Revision( $row ); + $text = $rev->getRawText(); + } catch ( MWException $e ) { + $this->output( "Text of revision with {$idCol}={$row->$idCol} unavailable!\n" ); + return false; // bug 22624? } - $text = $rev->getRawText(); if ( !is_string( $text ) ) { # This should not happen, but sometimes does (bug 20757) $this->output( "Text of revision with {$idCol}={$row->$idCol} unavailable!\n" ); @@ -161,6 +164,7 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { try { $rev = Revision::newFromArchiveRow( $row ); } catch ( MWException $e ) { + $this->output( "Text of revision with timestamp {$row->ar_timestamp} unavailable!\n" ); return false; // bug 22624? } $text = $rev->getRawText();