Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/core into Wikidata
[lhc/web/wiklou.git] / maintenance / populateRevisionSha1.php
index d8ff749..af9006b 100644 (file)
@@ -132,15 +132,18 @@ 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->getSerializedData();
+               } catch ( MWException $e ) {
+                       $this->output( "Data 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" );
+                       $this->output( "Data of revision with {$idCol}={$row->$idCol} unavailable!\n" );
                        return false;
                } else {
                        $db->update( $table,
@@ -161,12 +164,13 @@ 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();
+               $text = $rev->getSerializedData();
                if ( !is_string( $text ) ) {
                        # This should not happen, but sometimes does (bug 20757)
-                       $this->output( "Text of revision with timestamp {$row->ar_timestamp} unavailable!\n" );
+                       $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.