From e0db4e4c0c565ea78345fc11d1da586b8f7530c9 Mon Sep 17 00:00:00 2001 From: Christian Aistleitner Date: Fri, 29 Jun 2012 16:18:28 +0200 Subject: [PATCH] Eliminated deprecated functions in TextPassDumper Change-Id: I9f3148fe6044cc718e57b4aaaaf507f3342dc4d3 --- maintenance/backupTextPass.inc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/maintenance/backupTextPass.inc b/maintenance/backupTextPass.inc index 3846ef50b8..ec395eb0ed 100644 --- a/maintenance/backupTextPass.inc +++ b/maintenance/backupTextPass.inc @@ -171,10 +171,6 @@ class TextPassDumper extends BackupDumper { $input = fopen( $this->input, "rt" ); $result = $this->readDump( $input ); - if ( WikiError::isError( $result ) ) { - throw new MWException( $result->getMessage() ); - } - if ( $this->spawnProc ) { $this->closeSpawn(); } @@ -328,6 +324,10 @@ class TextPassDumper extends BackupDumper { } } + /** + * @throws MWException Failure to parse XML input + * @return true + */ function readDump( $input ) { $this->buffer = ""; $this->openElement = false; @@ -352,7 +352,18 @@ class TextPassDumper extends BackupDumper { $chunk = fread( $input, $bufferSize ); if ( !xml_parse( $parser, $chunk, feof( $input ) ) ) { wfDebug( "TextDumpPass::readDump encountered XML parsing error\n" ); - return new WikiXmlError( $parser, 'XML import parse failure', $chunk, $offset ); + + $byte = xml_get_current_byte_index( $parser ); + $msg = wfMsgHtml( 'xml-error-string', + 'XML import parse failure', + xml_get_current_line_number( $parser ), + xml_get_current_column_number( $parser ), + $byte . ( is_null( $chunk ) ? null : ( '; "' . substr( $chunk, $byte -$offset, 16 ) . '"' ) ), + xml_error_string( xml_get_error_code( $parser ) ) ); + + xml_parser_free( $parser ); + + throw new MWException( $msg ); } $offset += strlen( $chunk ); } while ( $chunk !== false && !feof( $input ) ); -- 2.20.1