X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateRevisionSha1.php;h=b401db0377e20f4e84df637adb7a9c3e7912145f;hb=cd73babf22a135f63ef3403283e4243f2b9c1323;hp=9bb510f956449473766b7dae6b8b7a1f6a2d3274;hpb=4114333da508a12e3d806345475534fb10aa871c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateRevisionSha1.php b/maintenance/populateRevisionSha1.php index 9bb510f956..b401db0377 100644 --- a/maintenance/populateRevisionSha1.php +++ b/maintenance/populateRevisionSha1.php @@ -50,6 +50,7 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $this->error( "archive table does not exist", true ); } elseif ( !$db->fieldExists( 'revision', 'rev_sha1', __METHOD__ ) ) { $this->output( "rev_sha1 column does not exist\n\n", true ); + return false; } @@ -61,7 +62,9 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $this->output( "Populating ar_sha1 column legacy rows\n" ); $ac += $this->doSha1LegacyUpdates(); - $this->output( "rev_sha1 and ar_sha1 population complete [$rc revision rows, $ac archive rows].\n" ); + $this->output( "rev_sha1 and ar_sha1 population complete " + . "[$rc revision rows, $ac archive rows].\n" ); + return true; } @@ -77,6 +80,7 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $end = $db->selectField( $table, "MAX($idCol)", false, __METHOD__ ); if ( !$start || !$end ) { $this->output( "...$table table seems to be empty.\n" ); + return 0; } @@ -103,6 +107,7 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $blockEnd += $this->mBatchSize; wfWaitForSlaves(); } + return $count; } @@ -130,6 +135,7 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { } } $db->commit( __METHOD__ ); + return $count; } @@ -147,13 +153,15 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { ? Revision::newFromArchiveRow( $row ) : new Revision( $row ); $text = $rev->getSerializedData(); - } catch ( MWException $e ) { + } catch ( Exception $e ) { $this->output( "Data of revision with {$idCol}={$row->$idCol} unavailable!\n" ); + return false; // bug 22624? } if ( !is_string( $text ) ) { # This should not happen, but sometimes does (bug 20757) $this->output( "Data of revision with {$idCol}={$row->$idCol} unavailable!\n" ); + return false; } else { $db->update( $table, @@ -161,6 +169,7 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { array( $idCol => $row->$idCol ), __METHOD__ ); + return true; } } @@ -173,14 +182,16 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $db = $this->getDB( DB_MASTER ); try { $rev = Revision::newFromArchiveRow( $row ); - } catch ( MWException $e ) { + } catch ( Exception $e ) { $this->output( "Text of revision with timestamp {$row->ar_timestamp} unavailable!\n" ); + return false; // bug 22624? } $text = $rev->getSerializedData(); if ( !is_string( $text ) ) { # This should not happen, but sometimes does (bug 20757) $this->output( "Data of revision with timestamp {$row->ar_timestamp} unavailable!\n" ); + return false; } else { # Archive table as no PK, but (NS,title,time) should be near unique. @@ -195,6 +206,7 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { ), __METHOD__ ); + return true; } }