Updated some try-catch statements: MWException -> Exception
[lhc/web/wiklou.git] / maintenance / populateRevisionSha1.php
index 9bb510f..b401db0 100644 (file)
@@ -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;
                }
        }