From 4e20a471ad9817fbaab48668ff3f42850825eac0 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Thu, 31 May 2012 21:05:40 +0200 Subject: [PATCH] reverse text/sha1 output in export to match xsd Change-Id: I84588e3d9692ee9eb7411b1e391abfc6c9ee89bf --- includes/Export.php | 12 ++++++------ tests/phpunit/maintenance/DumpTestCase.php | 5 ++--- tests/phpunit/maintenance/backupTextPassTest.php | 12 ++++++------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/includes/Export.php b/includes/Export.php index c201c97ada..fec6312232 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -644,6 +644,12 @@ class XmlDumpWriter { $out .= " " . Xml::elementClean( 'comment', array(), strval( $row->rev_comment ) ) . "\n"; } + if ( $row->rev_sha1 && !( $row->rev_deleted & Revision::DELETED_TEXT ) ) { + $out .= " " . Xml::element('sha1', null, strval( $row->rev_sha1 ) ) . "\n"; + } else { + $out .= " \n"; + } + $text = ''; if ( $row->rev_deleted & Revision::DELETED_TEXT ) { $out .= " " . Xml::element( 'text', array( 'deleted' => 'deleted' ) ) . "\n"; @@ -660,12 +666,6 @@ class XmlDumpWriter { "" ) . "\n"; } - if ( $row->rev_sha1 && !( $row->rev_deleted & Revision::DELETED_TEXT ) ) { - $out .= " " . Xml::element('sha1', null, strval( $row->rev_sha1 ) ) . "\n"; - } else { - $out .= " \n"; - } - wfRunHooks( 'XmlDumpWriterWriteRevision', array( &$this, &$out, $row, $text ) ); $out .= " \n"; diff --git a/tests/phpunit/maintenance/DumpTestCase.php b/tests/phpunit/maintenance/DumpTestCase.php index fd39c45b0e..2cf95dff54 100644 --- a/tests/phpunit/maintenance/DumpTestCase.php +++ b/tests/phpunit/maintenance/DumpTestCase.php @@ -314,13 +314,14 @@ abstract class DumpTestCase extends MediaWikiTestCase { $this->assertTextNode( "comment", $summary ); + $this->assertTextNode( "sha1", $text_sha1 ); + $this->assertNodeStart( "text", false ); if ( $text_bytes !== false ) { $this->assertEquals( $this->xml->getAttribute( "bytes" ), $text_bytes, "Attribute 'bytes' of revision " . $id ); } - if ( $text === false ) { // Testing for a stub $this->assertEquals( $this->xml->getAttribute( "id" ), $text_id, @@ -342,8 +343,6 @@ abstract class DumpTestCase extends MediaWikiTestCase { $this->skipWhitespace(); } - $this->assertTextNode( "sha1", $text_sha1 ); - $this->assertNodeEnd( "revision" ); $this->skipWhitespace(); } diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index 0dade60774..972fc7392d 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -478,8 +478,8 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP1Summary1 - 0bolhl6ol7i6x0e7yq91gxgaan39j87 + '; @@ -494,8 +494,8 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP2Summary1 - jprywrymfhysqllua29tj3sc7z39dl2 + ' . $this->revId2_2 . ' @@ -504,8 +504,8 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP2Summary2 - b7vj5ks32po5m1z1t1br4o7scdwwy95 + ' . $this->revId2_3 . ' @@ -514,8 +514,8 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP2Summary3 - jfunqmh1ssfb8rs43r19w98k28gg56r + ' . $this->revId2_4 . ' @@ -524,8 +524,8 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 BackupDumperTestP2Summary4 extra - 6o1ciaxa6pybnqprmungwofc4lv00wv + '; @@ -542,8 +542,8 @@ class TextPassDumperTest extends DumpTestCase { 127.0.0.1 Talk BackupDumperTestP1 Summary1 - nktofwzd0tl192k3zfepmlzxoax1lpe + '; -- 2.20.1