r109848 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109847‎ | r109848 | r109849 >
Date:19:48, 23 January 2012
Author:diederik
Status:ok (Comments)
Tags:core 
Comment:
Add the new SHA1 revision field to the XML export, add SHA1 field to export-0.6.xsd and fix namespace element from string to integer.
Modified paths:
  • /trunk/phase3/docs/export-0.6.xsd (modified) (history)
  • /trunk/phase3/includes/Export.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/export-0.6.xsd
@@ -15,8 +15,8 @@
1616
1717 Version 0.5 adds byte count per revision.
1818
19 - Version 0.6 adds a separate namespace tag, locates the
20 - redirect target and strips of the namespace from the title.
 19+ Version 0.6 adds a separate namespace tag, and resolves the
 20+ redirect target and adds a separate sha1 tag for each revision.
2121
2222 The canonical URL to the schema document is:
2323 http://www.mediawiki.org/xml/export-0.6.xsd
@@ -106,8 +106,8 @@
107107 <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
108108 <element name="title" type="string"/>
109109
110 - <!-- Namesapce in text form -->
111 - <element name="ns" type="string"/>
 110+ <!-- Namespace in canonical form -->
 111+ <element name="ns" type="positiveInteger"/>
112112
113113 <!-- optional page ID number -->
114114 <element name="id" type="positiveInteger" minOccurs="0"/>
@@ -137,6 +137,7 @@
138138 <element name="contributor" type="mw:ContributorType"/>
139139 <element name="minor" minOccurs="0" />
140140 <element name="comment" type="mw:CommentType" minOccurs="0"/>
 141+ <element name="sha1" type="string" />
141142 <element name="text" type="mw:TextType" />
142143 </sequence>
143144 </complexType>
Index: trunk/phase3/includes/Export.php
@@ -486,6 +486,13 @@
487487 $out .= ' ' . Xml::element( 'redirect', array( 'title' => self::canonicalTitle( $redirect ) ) ) . "\n";
488488 }
489489 }
 490+
 491+ if ( $row->rev_sha1 ) {
 492+ $out .= " " . Xml::element('sha1', null, strval($row->rev_sha1) ) . "\n";
 493+ } else {
 494+ $out .= " <sha1/>\n";
 495+ }
 496+
490497 if ( $row->page_restrictions != '' ) {
491498 $out .= ' ' . Xml::element( 'restrictions', array(),
492499 strval( $row->page_restrictions ) ) . "\n";

Sign-offs

UserFlagDate
Nikerabbitinspected07:07, 24 January 2012

Comments

#Comment by Siebrand (talk | contribs)   20:31, 23 January 2012

Why use raw XML instead of Xml::element() in export.php?

#Comment by Drdee (talk | contribs)   22:24, 23 January 2012

Because that is consistent with the rest of the code in Export.php. I don't find it particularly aesthetically pleasing either but then we would need to clean it up in the whole file.

#Comment by Duplicatebug (talk | contribs)   15:52, 3 March 2012

Why adding the sha1 in openPage? The xsd entry is for the revision, than you have to add the sha1 in method writeRevision.

#Comment by Duplicatebug (talk | contribs)   17:31, 5 March 2012
#Comment by Mormegil (talk | contribs)   16:01, 16 March 2012

In addition to the abovementioned bug 34963, see also bug 35264.

Status & tagging log