From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- includes/Export.php | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'includes/Export.php') diff --git a/includes/Export.php b/includes/Export.php index 87c735c1..7773d03c 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -56,7 +56,7 @@ class WikiExporter { * make additional queries to pull source data while the * main query is still running. * - * @param $db Database + * @param $db DatabaseBase * @param $history Mixed: one of WikiExporter::FULL, WikiExporter::CURRENT, * WikiExporter::RANGE or WikiExporter::STABLE, * or an associative array: @@ -380,7 +380,7 @@ class XmlDumpWriter { * @return string */ function schemaVersion() { - return "0.5"; + return "0.6"; } /** @@ -477,10 +477,22 @@ class XmlDumpWriter { $out = " \n"; $title = Title::makeTitle( $row->page_namespace, $row->page_title ); $out .= ' ' . Xml::elementClean( 'title', array(), self::canonicalTitle( $title ) ) . "\n"; + $out .= ' ' . Xml::element( 'ns', array(), strval( $row->page_namespace) ) . "\n"; $out .= ' ' . Xml::element( 'id', array(), strval( $row->page_id ) ) . "\n"; if ( $row->page_is_redirect ) { - $out .= ' ' . Xml::element( 'redirect', array() ) . "\n"; + $page = WikiPage::factory( $title ); + $redirect = $page->getRedirectTarget(); + if ( $redirect instanceOf Title && $redirect->isValidRedirectTarget() ) { + $out .= ' ' . Xml::element( 'redirect', array( 'title' => self::canonicalTitle( $redirect ) ) ) . "\n"; + } + } + + if ( $row->rev_sha1 ) { + $out .= " " . Xml::element('sha1', null, strval($row->rev_sha1) ) . "\n"; + } else { + $out .= " \n"; } + if ( $row->page_restrictions != '' ) { $out .= ' ' . Xml::element( 'restrictions', array(), strval( $row->page_restrictions ) ) . "\n"; @@ -538,12 +550,12 @@ class XmlDumpWriter { // Raw text from the database may have invalid chars $text = strval( Revision::getRevisionText( $row ) ); $out .= " " . Xml::elementClean( 'text', - array( 'xml:space' => 'preserve', 'bytes' => $row->rev_len ), + array( 'xml:space' => 'preserve', 'bytes' => intval( $row->rev_len ) ), strval( $text ) ) . "\n"; } else { // Stub output $out .= " " . Xml::element( 'text', - array( 'id' => $row->rev_text_id, 'bytes' => $row->rev_len ), + array( 'id' => $row->rev_text_id, 'bytes' => intval( $row->rev_len ) ), "" ) . "\n"; } @@ -609,7 +621,7 @@ class XmlDumpWriter { function writeContributor( $id, $text ) { $out = " \n"; - if ( $id ) { + if ( $id || !IP::isValid( $text ) ) { $out .= " " . Xml::elementClean( 'username', null, strval( $text ) ) . "\n"; $out .= " " . Xml::element( 'id', null, strval( $id ) ) . "\n"; } else { @@ -677,9 +689,10 @@ class XmlDumpWriter { * canonical namespace. This skips any special-casing such as gendered * user namespaces -- which while useful, are not yet listed in the * XML data so are unsafe in export. - * + * * @param Title $title * @return string + * @since 1.18 */ public static function canonicalTitle( Title $title ) { if ( $title->getInterwiki() ) { @@ -689,7 +702,7 @@ class XmlDumpWriter { global $wgContLang; $prefix = str_replace( '_', ' ', $wgContLang->getNsText( $title->getNamespace() ) ); - if ($prefix !== '') { + if ( $prefix !== '' ) { $prefix .= ':'; } @@ -892,8 +905,6 @@ class DumpBZip2Output extends DumpPipeOutput { * @ingroup Dump */ class Dump7ZipOutput extends DumpPipeOutput { - protected $filename; - function __construct( $file ) { $command = $this->setup7zCommand( $file ); parent::__construct( $command ); @@ -908,10 +919,6 @@ class Dump7ZipOutput extends DumpPipeOutput { return( $command ); } - function closeRenameAndReopen( $newname ) { - $this->closeAndRename( $newname, true ); - } - function closeAndRename( $newname, $open = false ) { $newname = $this->checkRenameArgCount( $newname ); if ( $newname ) { @@ -919,7 +926,7 @@ class Dump7ZipOutput extends DumpPipeOutput { proc_close( $this->procOpenResource ); $this->renameOrException( $newname ); if ( $open ) { - $command = $this->setup7zCommand( $file ); + $command = $this->setup7zCommand( $this->filename ); $this->startCommand( $command ); } } -- cgit v1.2.3-54-g00ecf