From 6209ef4086af8603d4a187581f74ab0a2ba18d93 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 1 Jun 2012 17:57:02 +0200 Subject: [PATCH] (bug 22750) is at wrong location in export.xsd * fix indent of logitem * add logtitle/params tags * change one Image: to File: Change-Id: I02e631d8c4679c46095320901cdff724533d66f0 --- docs/export-0.7.xsd | 27 ++++++++++++++++++++++++--- includes/Export.php | 42 +++++++++++++++++++++--------------------- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/docs/export-0.7.xsd b/docs/export-0.7.xsd index c2656a3203..2d6403625a 100644 --- a/docs/export-0.7.xsd +++ b/docs/export-0.7.xsd @@ -21,6 +21,7 @@ Version 0.7 adds a unique identity constraint for both page and revision identifiers. See also bug 4220. Fix type for from "positiveInteger" to "nonNegativeInteger" to allow 0 + Moves to its right location. The canonical URL to the schema document is: http://www.mediawiki.org/xml/export-0.7.xsd @@ -63,6 +64,8 @@ minOccurs="0" maxOccurs="1"/> + @@ -137,7 +140,6 @@ - @@ -165,7 +167,9 @@ - + + + @@ -193,6 +197,23 @@ + + + + + + + + + + + + + + + + + @@ -211,7 +232,7 @@ - + diff --git a/includes/Export.php b/includes/Export.php index c201c97ada..c73824dda1 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -685,37 +685,37 @@ class XmlDumpWriter { function writeLogItem( $row ) { wfProfileIn( __METHOD__ ); - $out = " \n"; - $out .= " " . Xml::element( 'id', null, strval( $row->log_id ) ) . "\n"; + $out = " \n"; + $out .= " " . Xml::element( 'id', null, strval( $row->log_id ) ) . "\n"; - $out .= $this->writeTimestamp( $row->log_timestamp ); + $out .= $this->writeTimestamp( $row->log_timestamp, " " ); if ( $row->log_deleted & LogPage::DELETED_USER ) { - $out .= " " . Xml::element( 'contributor', array( 'deleted' => 'deleted' ) ) . "\n"; + $out .= " " . Xml::element( 'contributor', array( 'deleted' => 'deleted' ) ) . "\n"; } else { - $out .= $this->writeContributor( $row->log_user, $row->user_name ); + $out .= $this->writeContributor( $row->log_user, $row->user_name, " " ); } if ( $row->log_deleted & LogPage::DELETED_COMMENT ) { - $out .= " " . Xml::element( 'comment', array( 'deleted' => 'deleted' ) ) . "\n"; + $out .= " " . Xml::element( 'comment', array( 'deleted' => 'deleted' ) ) . "\n"; } elseif ( $row->log_comment != '' ) { - $out .= " " . Xml::elementClean( 'comment', null, strval( $row->log_comment ) ) . "\n"; + $out .= " " . Xml::elementClean( 'comment', null, strval( $row->log_comment ) ) . "\n"; } - $out .= " " . Xml::element( 'type', null, strval( $row->log_type ) ) . "\n"; - $out .= " " . Xml::element( 'action', null, strval( $row->log_action ) ) . "\n"; + $out .= " " . Xml::element( 'type', null, strval( $row->log_type ) ) . "\n"; + $out .= " " . Xml::element( 'action', null, strval( $row->log_action ) ) . "\n"; if ( $row->log_deleted & LogPage::DELETED_ACTION ) { - $out .= " " . Xml::element( 'text', array( 'deleted' => 'deleted' ) ) . "\n"; + $out .= " " . Xml::element( 'text', array( 'deleted' => 'deleted' ) ) . "\n"; } else { $title = Title::makeTitle( $row->log_namespace, $row->log_title ); - $out .= " " . Xml::elementClean( 'logtitle', null, self::canonicalTitle( $title ) ) . "\n"; - $out .= " " . Xml::elementClean( 'params', + $out .= " " . Xml::elementClean( 'logtitle', null, self::canonicalTitle( $title ) ) . "\n"; + $out .= " " . Xml::elementClean( 'params', array( 'xml:space' => 'preserve' ), strval( $row->log_params ) ) . "\n"; } - $out .= " \n"; + $out .= " \n"; wfProfileOut( __METHOD__ ); return $out; @@ -725,9 +725,9 @@ class XmlDumpWriter { * @param $timestamp string * @return string */ - function writeTimestamp( $timestamp ) { + function writeTimestamp( $timestamp, $indent = " " ) { $ts = wfTimestamp( TS_ISO_8601, $timestamp ); - return " " . Xml::element( 'timestamp', null, $ts ) . "\n"; + return $indent . Xml::element( 'timestamp', null, $ts ) . "\n"; } /** @@ -735,15 +735,15 @@ class XmlDumpWriter { * @param $text string * @return string */ - function writeContributor( $id, $text ) { - $out = " \n"; + function writeContributor( $id, $text, $indent = " " ) { + $out = $indent . "\n"; if ( $id || !IP::isValid( $text ) ) { - $out .= " " . Xml::elementClean( 'username', null, strval( $text ) ) . "\n"; - $out .= " " . Xml::element( 'id', null, strval( $id ) ) . "\n"; + $out .= $indent . " " . Xml::elementClean( 'username', null, strval( $text ) ) . "\n"; + $out .= $indent . " " . Xml::element( 'id', null, strval( $id ) ) . "\n"; } else { - $out .= " " . Xml::elementClean( 'ip', null, strval( $text ) ) . "\n"; + $out .= $indent . " " . Xml::elementClean( 'ip', null, strval( $text ) ) . "\n"; } - $out .= " \n"; + $out .= $indent . "\n"; return $out; } -- 2.20.1