jenkins-bot has submitted this change and it was merged.

Change subject: Drop support for xml format in Special:EntityData
......................................................................


Drop support for xml format in Special:EntityData

Bug: T93353
Change-Id: I3557793068f5050eddcc55dfa418aeab40dd127b
---
M repo/config/Wikibase.default.php
M repo/includes/LinkedData/EntityDataSerializationService.php
M repo/tests/phpunit/includes/LinkedData/EntityDataRequestHandlerTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
M repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
6 files changed, 16 insertions(+), 37 deletions(-)

Approvals:
  Hoo man: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/config/Wikibase.default.php b/repo/config/Wikibase.default.php
index 848be40..7a451b7 100644
--- a/repo/config/Wikibase.default.php
+++ b/repo/config/Wikibase.default.php
@@ -59,7 +59,6 @@
                        // using the API
                        'json', // default
                        'php',
-                       'xml',
 
                        // using easyRdf
                        'rdfxml',
diff --git a/repo/includes/LinkedData/EntityDataSerializationService.php 
b/repo/includes/LinkedData/EntityDataSerializationService.php
index e5965fc..15218eb 100644
--- a/repo/includes/LinkedData/EntityDataSerializationService.php
+++ b/repo/includes/LinkedData/EntityDataSerializationService.php
@@ -439,9 +439,6 @@
                        case 'txt':
                                return array( "text/text", "text/plain" );
 
-                       case 'xml':
-                               return array( "application/xml", "text/xml" );
-
                        case 'javascript':
                                return array( "text/javascript" );
 
@@ -569,19 +566,8 @@
                // function gets called multiple times during testing, etc.
                $res->reset();
 
-               if ( $printer->getNeedsRawData() ) {
-                       // force raw mode, to trigger indexed tag names
-                       $res->setRawMode();
-               }
-
                //TODO: apply language filter/Fallback via options!
                $options = new SerializationOptions();
-
-               if ( $printer instanceof ApiFormatXml ) {
-                       $options->setIndexTags( true );
-                       // XXX: hack to force the top level element's name
-                       $printer->setRootElement( $entityKey );
-               }
 
                $resultBuilder = new ResultBuilder(
                        $res,
diff --git 
a/repo/tests/phpunit/includes/LinkedData/EntityDataRequestHandlerTest.php 
b/repo/tests/phpunit/includes/LinkedData/EntityDataRequestHandlerTest.php
index 7d953d8..3518241 100644
--- a/repo/tests/phpunit/includes/LinkedData/EntityDataRequestHandlerTest.php
+++ b/repo/tests/phpunit/includes/LinkedData/EntityDataRequestHandlerTest.php
@@ -104,7 +104,6 @@
                                // using the API
                                'json', // default
                                'php',
-                               'xml',
 
                                // using easyRdf
                                'rdfxml',
@@ -118,7 +117,6 @@
                        // using the API
                        'json' => 'json', // default
                        'php' => 'php',
-                       'xml' => 'xml',
 
                        // using easyRdf
                        'rdfxml' => 'rdf',
diff --git 
a/repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php 
b/repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php
index 7b42927..7cda931 100644
--- 
a/repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php
+++ 
b/repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php
@@ -63,7 +63,6 @@
                                // using the API
                                'json', // default
                                'php',
-                               'xml',
 
                                // using RdfWriter
                                'rdfxml',
@@ -101,19 +100,16 @@
        private static $apiMimeTypes = array(
                'application/vnd.php.serialized',
                'application/json',
-               'text/xml'
        );
 
        private static $apiExtensions = array(
                'php',
                'json',
-               'xml'
        );
 
        private static $apiFormats = array(
                'php',
                'json',
-               'xml'
        );
 
        private static $rdfMimeTypes = array(
@@ -155,14 +151,12 @@
        private static $badFormats = array(
                'html',
                'text',
+               'xml',
        );
 
        private static $formatMappings = array(
                'json' => 'json', // should be api json
                'application/json' => 'json', // should be api json
-               'xml' => 'xml', // should be api xml, not rdfxml
-               'text/xml' => 'xml', // should be api xml, not rdfxml
-               'application/xml' => 'xml', // should be api xml, not rdfxml
                'application/rdf+xml' => 'rdfxml', // should be rdfxml
                'text/n-triples' => 'ntriples', // should be ntriples
                'text/plain' => 'ntriples', // should be ntriples
diff --git a/repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php 
b/repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
index eaddf6f..4df8e2d 100644
--- a/repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
+++ b/repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
@@ -141,17 +141,17 @@
                        415,  // http code
                );
 
-               $cases[] = array( // #8: xml, redirected id
+               $cases[] = array( // #8: redirected id
                        '',      // subpage
                        array( // parameters
                                'id' => 'Q22',
-                               'format' => 'xml',
+                               'format' => 'application/json',
                        ),
                        array(), // headers
-                       '!<entity!', // output regex
+                       '!^\{.*Raarr!', // output regex
                        200,       // http code
                        array( // headers
-                               'Content-Type' => '!^text/xml(;|$)!'
+                               'Content-Type' => '!^application/json(;|$)!'
                        )
                );
 
@@ -399,7 +399,7 @@
 
                // #35: IMS from the deep bast should return a 200 (revision 
timestamp is 20131211100908)
                $cases[] = array(
-                       'Q42.xml',        // subpage
+                       'Q42.json',       // subpage
                        array(), // parameters
                        array( // headers
                                'If-Modified-Since' => wfTimestamp( TS_RFC2822, 
'20000101000000' )
@@ -419,6 +419,15 @@
                        304,  // http code
                );
 
+               // #37: invalid, no longer supported XML format
+               $cases[] = array(
+                       'Q42.xml',
+                       array(),
+                       array(),
+                       '!!', // output regex
+                       415, // http code
+               );
+
                return $cases;
        }
 
@@ -433,13 +442,6 @@
                        $entityRev, // entityRev
                        '!^\{.*Raarrr!', // output regex
                        'application/json',       // expected mime
-               );
-
-               $cases[] = array( // #1: xml
-                       'xml',      // format
-                       $entityRev, // entityRev
-                       '!<entity!', // output regex
-                       'text/xml',       // expected mime
                );
 
                return $cases;
diff --git a/repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php 
b/repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
index bc15c15..49be340 100644
--- a/repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
+++ b/repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
@@ -84,7 +84,7 @@
                );
 
                $maxAge = 60*60;
-               $formats = array( 'json', 'xml', 'rdf', 'n3' );
+               $formats = array( 'json', 'rdf', 'n3' );
                $serializationService->setFormatWhiteList( $formats );
 
                $defaultFormat = 'rdf';

-- 
To view, visit https://gerrit.wikimedia.org/r/201487
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3557793068f5050eddcc55dfa418aeab40dd127b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: JanZerebecki <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to