Merge "don't die producing xml files if rev text export conversion fails"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 22 Mar 2019 09:22:41 +0000 (09:22 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 22 Mar 2019 09:22:41 +0000 (09:22 +0000)
includes/export/XmlDumpWriter.php

index 3c0b569..6ca8853 100644 (file)
@@ -286,7 +286,12 @@ class XmlDumpWriter {
                } elseif ( isset( $row->old_text ) ) {
                        // Raw text from the database may have invalid chars
                        $text = strval( Revision::getRevisionText( $row ) );
-                       $text = $content_handler->exportTransform( $text, $content_format );
+                       try {
+                               $text = $content_handler->exportTransform( $text, $content_format );
+                       }
+                       catch ( MWException $ex ) {
+                               // leave text as is; that's the way it goes
+                       }
                        $out .= "      " . Xml::elementClean( 'text',
                                [ 'xml:space' => 'preserve', 'bytes' => intval( $row->rev_len ) ],
                                strval( $text ) ) . "\n";