Work around annoying Revision::newFromArchiveRow exception.
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 23 May 2012 20:18:57 +0000 (13:18 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 23 May 2012 20:18:57 +0000 (13:18 -0700)
Change-Id: Ib5cfae54b12fd2fee5120d7dbae7a1e2b99b0181

maintenance/populateRevisionSha1.php

index 6125fc0..2266a3f 100644 (file)
@@ -145,7 +145,7 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance {
                        $db->update( $table,
                                array( "{$prefix}_sha1" => Revision::base36Sha1( $text ) ),
                                array( $idCol => $row->$idCol ),
-                               __METHOD__ 
+                               __METHOD__
                        );
                        return true;
                }
@@ -157,7 +157,11 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance {
         */
        protected function upgradeLegacyArchiveRow( $row ) {
                $db = $this->getDB( DB_MASTER );
-               $rev = Revision::newFromArchiveRow( $row );
+               try {
+                       $rev = Revision::newFromArchiveRow( $row );
+               } catch ( MWException $e ) {
+                       return false; // bug 22624?
+               }
                $text = $rev->getRawText();
                if ( !is_string( $text ) ) {
                        # This should not happen, but sometimes does (bug 20757)
@@ -174,7 +178,7 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance {
                                        'ar_timestamp' => $row->ar_timestamp,
                                        'ar_len'       => $row->ar_len // extra sanity
                                ),
-                               __METHOD__ 
+                               __METHOD__
                        );
                        return true;
                }