r102575 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102574‎ | r102575 | r102576 >
Date:21:15, 9 November 2011
Author:diederik
Status:resolved (Comments)
Tags:lamecommitsummary 
Comment:
Commit to fix bug 30513.
Modified paths:
  • /trunk/phase3/docs/export-0.5.xsd (modified) (history)
  • /trunk/phase3/docs/export-0.6.xsd (added) (history)
  • /trunk/phase3/includes/Export.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/export-0.6.xsd
@@ -0,0 +1,225 @@
 2+<?xml version="1.0" encoding="UTF-8" ?>
 3+<!--
 4+ This is an XML Schema description of the format
 5+ output by MediaWiki's Special:Export system.
 6+
 7+ Version 0.2 adds optional basic file upload info support,
 8+ which is used by our OAI export/import submodule.
 9+
 10+ Version 0.3 adds some site configuration information such
 11+ as a list of defined namespaces.
 12+
 13+ Version 0.4 adds per-revision delete flags, log exports,
 14+ discussion threading data, a per-page redirect flag, and
 15+ per-namespace capitalization.
 16+
 17+ Version 0.5 adds byte count per revision.
 18+
 19+ Version 0.6 adds a separate namespace tag, locates the
 20+ redirect target and strips of the namespace from the title.
 21+
 22+ The canonical URL to the schema document is:
 23+ http://www.mediawiki.org/xml/export-0.6.xsd
 24+
 25+ Use the namespace:
 26+ http://www.mediawiki.org/xml/export-0.6/
 27+-->
 28+<schema xmlns="http://www.w3.org/2001/XMLSchema"
 29+ xmlns:mw="http://www.mediawiki.org/xml/export-0.6/"
 30+ targetNamespace="http://www.mediawiki.org/xml/export-0.6/"
 31+ elementFormDefault="qualified">
 32+
 33+ <annotation>
 34+ <documentation xml:lang="en">
 35+ MediaWiki's page export format
 36+ </documentation>
 37+ </annotation>
 38+
 39+ <!-- Need this to reference xml:lang -->
 40+ <import namespace="http://www.w3.org/XML/1998/namespace"
 41+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
 42+
 43+ <!-- Our root element -->
 44+ <element name="mediawiki" type="mw:MediaWikiType"/>
 45+
 46+ <complexType name="MediaWikiType">
 47+ <sequence>
 48+ <element name="siteinfo" type="mw:SiteInfoType"
 49+ minOccurs="0" maxOccurs="1"/>
 50+ <element name="page" type="mw:PageType"
 51+ minOccurs="0" maxOccurs="unbounded"/>
 52+ </sequence>
 53+ <attribute name="version" type="string" use="required"/>
 54+ <attribute ref="xml:lang" use="required"/>
 55+ </complexType>
 56+
 57+ <complexType name="SiteInfoType">
 58+ <sequence>
 59+ <element name="sitename" type="string" minOccurs="0" />
 60+ <element name="base" type="anyURI" minOccurs="0" />
 61+ <element name="generator" type="string" minOccurs="0" />
 62+ <element name="case" type="mw:CaseType" minOccurs="0" />
 63+ <element name="namespaces" type="mw:NamespacesType" minOccurs="0" />
 64+ </sequence>
 65+ </complexType>
 66+
 67+ <simpleType name="CaseType">
 68+ <restriction base="NMTOKEN">
 69+ <!-- Cannot have two titles differing only by case of first letter. -->
 70+ <!-- Default behavior through 1.5, $wgCapitalLinks = true -->
 71+ <enumeration value="first-letter" />
 72+
 73+ <!-- Complete title is case-sensitive -->
 74+ <!-- Behavior when $wgCapitalLinks = false -->
 75+ <enumeration value="case-sensitive" />
 76+
 77+ <!-- Cannot have non-case senstitive titles eg [[FOO]] == [[Foo]] -->
 78+ <!-- Not yet implemented as of MediaWiki 1.18 -->
 79+ <enumeration value="case-insensitive" />
 80+ </restriction>
 81+ </simpleType>
 82+
 83+ <simpleType name="DeletedFlagType">
 84+ <restriction base="NMTOKEN">
 85+ <enumeration value="deleted"/>
 86+ </restriction>
 87+ </simpleType>
 88+
 89+ <complexType name="NamespacesType">
 90+ <sequence>
 91+ <element name="namespace" type="mw:NamespaceType"
 92+ minOccurs="0" maxOccurs="unbounded" />
 93+ </sequence>
 94+ </complexType>
 95+
 96+ <complexType name="NamespaceType">
 97+ <simpleContent>
 98+ <extension base="string">
 99+ <attribute name="key" type="integer" />
 100+ <attribute name="case" type="mw:CaseType" />
 101+ </extension>
 102+ </simpleContent>
 103+ </complexType>
 104+
 105+ <complexType name="PageType">
 106+ <sequence>
 107+ <!-- Title in text form. (Using spaces, not underscores; with namespace ) -->
 108+ <element name="title" type="string"/>
 109+
 110+ <!-- Namesapce in text form -->
 111+ <element name="ns" type="string"/>
 112+
 113+ <!-- optional page ID number -->
 114+ <element name="id" type="positiveInteger" minOccurs="0"/>
 115+
 116+ <!-- flag if the current revision is a redirect -->
 117+ <element name="redirect" type="string" minOccurs="0"/>
 118+
 119+ <!-- comma-separated list of string tokens, if present -->
 120+ <element name="restrictions" type="string" minOccurs="0"/>
 121+
 122+ <!-- Zero or more sets of revision or upload data -->
 123+ <choice minOccurs="0" maxOccurs="unbounded">
 124+ <element name="revision" type="mw:RevisionType" />
 125+ <element name="upload" type="mw:UploadType" />
 126+ <element name="logitem" type="mw:LogItemType" />
 127+ </choice>
 128+
 129+ <!-- Zero or One sets of discussion threading data -->
 130+ <element name="discussionthreadinginfo" minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" />
 131+ </sequence>
 132+ </complexType>
 133+
 134+ <complexType name="RevisionType">
 135+ <sequence>
 136+ <element name="id" type="positiveInteger" minOccurs="0"/>
 137+ <element name="timestamp" type="dateTime"/>
 138+ <element name="contributor" type="mw:ContributorType"/>
 139+ <element name="minor" minOccurs="0" />
 140+ <element name="comment" type="mw:CommentType" minOccurs="0"/>
 141+ <element name="text" type="mw:TextType" />
 142+ </sequence>
 143+ </complexType>
 144+
 145+ <complexType name="LogItemType">
 146+ <sequence>
 147+ <element name="id" type="positiveInteger" minOccurs="0"/>
 148+ <element name="timestamp" type="dateTime"/>
 149+ <element name="contributor" type="mw:ContributorType"/>
 150+ <element name="comment" type="mw:CommentType" minOccurs="0"/>
 151+ <element name="type" type="string" />
 152+ <element name="action" type="string" />
 153+ <element name="text" type="mw:TextType" />
 154+ </sequence>
 155+ </complexType>
 156+
 157+ <complexType name="CommentType">
 158+ <simpleContent>
 159+ <extension base="string">
 160+ <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
 161+ <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
 162+ </extension>
 163+ </simpleContent>
 164+ </complexType>
 165+
 166+
 167+ <complexType name="TextType">
 168+ <simpleContent>
 169+ <extension base="string">
 170+ <attribute ref="xml:space" use="optional" default="preserve" />
 171+ <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
 172+ <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
 173+ <!-- This isn't a good idea; we should be using "ID" instead of "NMTOKEN" -->
 174+ <!-- However, "NMTOKEN" is strictest definition that is both compatible with existing -->
 175+ <!-- usage ([0-9]+) and with the "ID" type. -->
 176+ <attribute name="id" type="NMTOKEN"/>
 177+ <attribute name="bytes" use="optional" type="nonNegativeInteger"/>
 178+ </extension>
 179+ </simpleContent>
 180+ </complexType>
 181+
 182+ <complexType name="ContributorType">
 183+ <sequence>
 184+ <element name="username" type="string" minOccurs="0"/>
 185+ <element name="id" type="positiveInteger" minOccurs="0" />
 186+
 187+ <element name="ip" type="string" minOccurs="0"/>
 188+ </sequence>
 189+ <!-- This allows deleted=deleted on non-empty elements, but XSD is not omnipotent -->
 190+ <attribute name="deleted" use="optional" type="mw:DeletedFlagType"/>
 191+ </complexType>
 192+
 193+ <complexType name="UploadType">
 194+ <sequence>
 195+ <!-- Revision-style data... -->
 196+ <element name="timestamp" type="dateTime"/>
 197+ <element name="contributor" type="mw:ContributorType"/>
 198+ <element name="comment" type="string" minOccurs="0"/>
 199+
 200+ <!-- Filename. (Using underscores, not spaces. No 'Image:' namespace marker.) -->
 201+ <element name="filename" type="string"/>
 202+
 203+ <!-- URI at which this resource can be obtained -->
 204+ <element name="src" type="anyURI"/>
 205+
 206+ <element name="size" type="positiveInteger" />
 207+
 208+ <!-- TODO: add other metadata fields -->
 209+ </sequence>
 210+ </complexType>
 211+
 212+ <!-- Discussion threading data for LiquidThreads -->
 213+ <complexType name="DiscussionThreadingInfo">
 214+ <sequence>
 215+ <element name="ThreadSubject" type="string" />
 216+ <element name="ThreadParent" type="positiveInteger" />
 217+ <element name="ThreadAncestor" type="positiveInteger" />
 218+ <element name="ThreadPage" type="string" />
 219+ <element name="ThreadID" type="positiveInteger" />
 220+ <element name="ThreadAuthor" type="string" />
 221+ <element name="ThreadEditStatus" type="string" />
 222+ <element name="ThreadType" type="string" />
 223+ </sequence>
 224+ </complexType>
 225+
 226+</schema>
Property changes on: trunk/phase3/docs/export-0.6.xsd
___________________________________________________________________
Added: svn:eol-style
1227 + native
Index: trunk/phase3/docs/export-0.5.xsd
@@ -12,6 +12,8 @@
1313 Version 0.4 adds per-revision delete flags, log exports,
1414 discussion threading data, a per-page redirect flag, and
1515 per-namespace capitalization.
 16+
 17+ Version 0.5 adds byte count per revision.
1618
1719 The canonical URL to the schema document is:
1820 http://www.mediawiki.org/xml/export-0.5.xsd
Index: trunk/phase3/includes/Export.php
@@ -380,7 +380,7 @@
381381 * @return string
382382 */
383383 function schemaVersion() {
384 - return "0.5";
 384+ return "0.6";
385385 }
386386
387387 /**
@@ -476,10 +476,15 @@
477477 function openPage( $row ) {
478478 $out = " <page>\n";
479479 $title = Title::makeTitle( $row->page_namespace, $row->page_title );
480 - $out .= ' ' . Xml::elementClean( 'title', array(), $title->getPrefixedText() ) . "\n";
 480+ $out .= ' ' . Xml::elementClean( 'title', array(), strval( $title->getPrefixedText() ) ) . "\n";
 481+ $out .= ' ' . Xml::element( 'ns', array(), strval( $row->page_namespace) ) . "\n";
481482 $out .= ' ' . Xml::element( 'id', array(), strval( $row->page_id ) ) . "\n";
482483 if ( $row->page_is_redirect ) {
483 - $out .= ' ' . Xml::element( 'redirect', array() ) . "\n";
 484+ $page = WikiPage::factory( $title );
 485+ $redirect = $page->getRedirectTarget();
 486+ if ( $redirect !== null ) {
 487+ $out .= ' ' . Xml::element( 'redirect', array( 'title' => strval( $redirect ) ) ) . "\n";
 488+ }
484489 }
485490 if ( $row->page_restrictions != '' ) {
486491 $out .= ' ' . Xml::element( 'restrictions', array(),

Follow-up revisions

RevisionCommit summaryAuthorDate
r103147Followup r102575, delete export-0.6.xsd to create from a copy of export-0.5.xsdreedy11:02, 15 November 2011
r103148Followup r102575, recreate export-0.6.xsd copied with export-0.5.xsd historyreedy11:04, 15 November 2011
r103945* (bug 32376) XML export tweak to use canonical user namespaces instead of ge...brion19:33, 22 November 2011
r108764This commit restores getPrefixedText() to the Title in the XML. This means i...diederik21:34, 12 January 2012
r109889Added the following three items:...diederik01:14, 24 January 2012

Comments

#Comment by Reedy (talk | contribs)   00:59, 10 November 2011

Subscribing for this rev

When it's been reviewed and is ok, I'll get it into http://www.mediawiki.org/xml

That and 0.5 needs updating on the site (minor point, I know)

#Comment by Reedy (talk | contribs)   01:01, 10 November 2011

A RELEASE-NOTES entry wouldn't go a miss aswell

#Comment by Platonides (talk | contribs)   22:21, 14 November 2011

bug 305113 Comment 12: "Note for the committer: export-0.6.xsd should be added with export-0.5.xsd as history" :(

#Comment by Reedy (talk | contribs)   11:04, 15 November 2011

Fixed

#Comment by Umherirrender (talk | contribs)   10:40, 18 November 2011

Namesapce in text form is wrong. The ns tag contains a (positive) integer. The text is in the siteinfo.

#Comment by Umherirrender (talk | contribs)   10:59, 18 November 2011

I am missing a explaination in the xsd for the new title attribute of the redirect tag. The tag is defined as string type, but does not contain any text. Maybe it is better to give the title as content or it that not b/c to the 0.5 version?

<redirect title="target" />
<redirect>target</redirect>
#Comment by Hashar (talk | contribs)   11:29, 17 January 2012

Is there anything else to review / fix or this is just missing a release note?

#Comment by 😂 (talk | contribs)   16:00, 20 January 2012

Definitely needs release notes if we're bumping the export version.

#Comment by Drdee (talk | contribs)   19:41, 23 January 2012

Where can I find the release notes where I should add this information?

#Comment by Platonides (talk | contribs)   20:18, 23 January 2012

trunk/phase3/RELEASE-NOTES-1.19

#Comment by Drdee (talk | contribs)   01:15, 24 January 2012

I have added the following lines to the RELEAS-NOTES-1.19:

  • (bug 27775) Namespace has it's own XML tag in the XML dump file.
  • (bug 30513) Redirect tag is now resolved in XML dump file.
  • sha1 xml tag added to XML dump file.
#Comment by Reedy (talk | contribs)   21:37, 27 January 2012

Logged bug 33995 to put this on mw.org around deployment time

Status & tagging log