From 45831b2213a83262c1c77e771bd4aaf665cd629c Mon Sep 17 00:00:00 2001 From: "Ariel T. Glenn" Date: Thu, 14 Mar 2019 01:16:24 +0200 Subject: [PATCH] don't die producing xml files if rev text export conversion fails In abstracts for the specific case, we don't care at all, since the problem is that it's a self redirect. Redirects are filtered out of the stream at the end so it won't even show up. In anything else, we do what dumpTextPass does already, which is to leave the text alone and emit it as is. Bug: T217329 Change-Id: I39cdf89531c67962b1a9bba4e0a91f7c655ad6f3 --- includes/export/XmlDumpWriter.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/export/XmlDumpWriter.php b/includes/export/XmlDumpWriter.php index fae8b62999..5a440400f3 100644 --- a/includes/export/XmlDumpWriter.php +++ b/includes/export/XmlDumpWriter.php @@ -254,7 +254,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"; -- 2.20.1