From da3c19fb17834d800e15e16d998f2c158b69dfa4 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 24 Oct 2014 15:48:20 +0200 Subject: [PATCH] Change position of and tags in XML dumps. Bug: 72417 Change-Id: I1d11ce8147cf0bf0018e3931202f533afd4ea93e --- RELEASE-NOTES-1.25 | 5 + docs/export-0.10.xsd | 294 ++++++++++++++++++ docs/export-demo.xml | 18 +- includes/Export.php | 8 +- tests/phpunit/includes/ImportTest.php | 8 +- tests/phpunit/maintenance/DumpTestCase.php | 12 +- .../maintenance/backupTextPassTest.php | 18 +- 7 files changed, 331 insertions(+), 32 deletions(-) create mode 100644 docs/export-0.10.xsd diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25 index 7137d57879..d75d1f5d3f 100644 --- a/RELEASE-NOTES-1.25 +++ b/RELEASE-NOTES-1.25 @@ -156,6 +156,11 @@ changes to languages because of Bugzilla reports. * The "temp" zone of the upload respository is now considered private. If it already exists (such as under the images/ directory), please make sure that the directory is not web readable (e.g. via a .htaccess file). +* BREAKING CHANGE: In the XML dump format used by Special:Export and + dumpBackup.php, the and tags now apprear before the + tag, instead of after the and tags. + The new schema version is 0.10, the new schema URI is + . == Compatibility == diff --git a/docs/export-0.10.xsd b/docs/export-0.10.xsd new file mode 100644 index 0000000000..9d5d49e08e --- /dev/null +++ b/docs/export-0.10.xsd @@ -0,0 +1,294 @@ + + + + + + + MediaWiki's page export format + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/export-demo.xml b/docs/export-demo.xml index fd47d13a8b..e96bd6c2a6 100644 --- a/docs/export-demo.xml +++ b/docs/export-demo.xml @@ -1,4 +1,4 @@ - + @@ -82,10 +82,10 @@ I have just one thing to say! - A bunch of [[text]] here. - 5x0ux8iwjrbmfzgv6pkketxgkcnpr7h wikitext text/x-wiki + A bunch of [[text]] here. + 5x0ux8iwjrbmfzgv6pkketxgkcnpr7h @@ -95,10 +95,10 @@ 10.0.0.2 new! - An earlier [[revision]]. - etaxt3shcge6igz1biwy3d4um2pnle4 wikitext text/x-wiki + An earlier [[revision]]. + etaxt3shcge6igz1biwy3d4um2pnle4 @@ -111,10 +111,10 @@ 2001-01-15T14:03:00Z 10.0.0.2 hey - WHYD YOU LOCK PAGE??!!! i was editing that jerk - ml80vmyjlixdstnywwihx003exfzq9j wikitext text/x-wiki + WHYD YOU LOCK PAGE??!!! i was editing that jerk + ml80vmyjlixdstnywwihx003exfzq9j @@ -127,10 +127,10 @@ 2001-01-15T20:34:12Z Foobar42 My awesomeest image! - This is an awesome little imgae. I lurves it. {{PD}} - mehom37npwkpzhaiwu3wyr0egalumki wikitext text/x-wiki + This is an awesome little imgae. I lurves it. {{PD}} + mehom37npwkpzhaiwu3wyr0egalumki 2001-01-15T20:34:12Z diff --git a/includes/Export.php b/includes/Export.php index dee0a864d4..840e723a9f 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -69,7 +69,7 @@ class WikiExporter { * @return string */ public static function schemaVersion() { - return "0.9"; + return "0.10"; } /** @@ -693,6 +693,9 @@ class XmlDumpWriter { $content_format = $content_handler->getDefaultFormat(); } + $out .= " " . Xml::element( 'model', null, strval( $content_model ) ) . "\n"; + $out .= " " . Xml::element( 'format', null, strval( $content_format ) ) . "\n"; + $text = ''; if ( isset( $row->rev_deleted ) && ( $row->rev_deleted & Revision::DELETED_TEXT ) ) { $out .= " " . Xml::element( 'text', array( 'deleted' => 'deleted' ) ) . "\n"; @@ -719,9 +722,6 @@ class XmlDumpWriter { $out .= " \n"; } - $out .= " " . Xml::element( 'model', null, strval( $content_model ) ) . "\n"; - $out .= " " . Xml::element( 'format', null, strval( $content_format ) ) . "\n"; - wfRunHooks( 'XmlDumpWriterWriteRevision', array( &$this, &$out, $row, $text ) ); $out .= " \n"; diff --git a/tests/phpunit/includes/ImportTest.php b/tests/phpunit/includes/ImportTest.php index 77e8169f03..678c89bfa9 100644 --- a/tests/phpunit/includes/ImportTest.php +++ b/tests/phpunit/includes/ImportTest.php @@ -45,7 +45,7 @@ class ImportTest extends MediaWikiLangTestCase { return array( array( <<< EOF - + Test 0 @@ -59,10 +59,10 @@ class ImportTest extends MediaWikiLangTestCase { 10 Admin moved page [[Test]] to [[Test22]] - #REDIRECT [[Test22]] - tq456o9x3abm7r9ozi6km8yrbbc56o6 wikitext text/x-wiki + #REDIRECT [[Test22]] + tq456o9x3abm7r9ozi6km8yrbbc56o6 @@ -72,7 +72,7 @@ EOF ), array( <<< EOF - + Test 0 diff --git a/tests/phpunit/maintenance/DumpTestCase.php b/tests/phpunit/maintenance/DumpTestCase.php index 8b6aef53bf..415e11b795 100644 --- a/tests/phpunit/maintenance/DumpTestCase.php +++ b/tests/phpunit/maintenance/DumpTestCase.php @@ -330,6 +330,12 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { $this->assertTextNode( "comment", $summary ); $this->skipWhitespace(); + $this->assertTextNode( "model", $model ); + $this->skipWhitespace(); + + $this->assertTextNode( "format", $format ); + $this->skipWhitespace(); + if ( $this->xml->name == "text" ) { // note: tag may occur here or at the very end. $text_found = true; @@ -340,12 +346,6 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { $this->assertTextNode( "sha1", $text_sha1 ); - $this->assertTextNode( "model", $model ); - $this->skipWhitespace(); - - $this->assertTextNode( "format", $format ); - $this->skipWhitespace(); - if ( !$text_found ) { $this->assertText( $id, $text_id, $text_bytes, $text ); } diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index a37a97c78f..e620b080d1 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -440,10 +440,10 @@ class TextPassDumperTest extends DumpTestCase { if ( $fname === null ) { $fname = $this->getNewTempFile(); } - $header = ' + . 'xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ ' + . 'http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en"> wikisvn http://localhost/wiki-svn/index.php/Main_Page @@ -489,10 +489,10 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP1Summary1 - 0bolhl6ol7i6x0e7yq91gxgaan39j87 wikitext text/x-wiki + 0bolhl6ol7i6x0e7yq91gxgaan39j87 '; @@ -507,10 +507,10 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP2Summary1 - jprywrymfhysqllua29tj3sc7z39dl2 wikitext text/x-wiki + jprywrymfhysqllua29tj3sc7z39dl2 ' . ( $this->revId2_2 + $i * self::$numOfRevs ) . ' @@ -520,10 +520,10 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP2Summary2 - b7vj5ks32po5m1z1t1br4o7scdwwy95 wikitext text/x-wiki + b7vj5ks32po5m1z1t1br4o7scdwwy95 ' . ( $this->revId2_3 + $i * self::$numOfRevs ) . ' @@ -533,10 +533,10 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP2Summary3 - jfunqmh1ssfb8rs43r19w98k28gg56r wikitext text/x-wiki + jfunqmh1ssfb8rs43r19w98k28gg56r ' . ( $this->revId2_4 + $i * self::$numOfRevs ) . ' @@ -546,10 +546,10 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP2Summary4 extra - 6o1ciaxa6pybnqprmungwofc4lv00wv wikitext text/x-wiki + 6o1ciaxa6pybnqprmungwofc4lv00wv '; @@ -566,10 +566,10 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 Talk BackupDumperTestP1 Summary1 - nktofwzd0tl192k3zfepmlzxoax1lpe wikitext text/x-wiki + nktofwzd0tl192k3zfepmlzxoax1lpe '; -- 2.20.1