Yaron Koren has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/61784


Change subject: Added "titles=" parameter for Special:ViewXML, in the manner of 
the MW API
......................................................................

Added "titles=" parameter for Special:ViewXML, in the manner of the MW API

Change-Id: Ifa04765f91000bfa1874ab12b2858a8c81527375
---
M specials/DT_ViewXML.php
1 file changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataTransfer 
refs/changes/84/61784/1

diff --git a/specials/DT_ViewXML.php b/specials/DT_ViewXML.php
index bbf1593..e2e2474 100644
--- a/specials/DT_ViewXML.php
+++ b/specials/DT_ViewXML.php
@@ -268,7 +268,8 @@
                $form_submitted = false;
                $cats = $wgRequest->getArray( 'categories' );
                $nses = $wgRequest->getArray( 'namespaces' );
-               if ( count( $cats ) > 0 || count( $nses ) > 0 ) {
+               $requestedTitles = $wgRequest->getVal( 'titles' );
+               if ( count( $cats ) > 0 || count( $nses ) > 0 || 
$requestedTitles != null ) {
                        $form_submitted = true;
                }
 
@@ -323,6 +324,20 @@
                                                $text .= "</$namespace_str>\n";
                                }
                        }
+
+                       // The user can specify a set of page names to view
+                       // the XML of, using a "titles=" parameter, separated
+                       // by "|", in the manner of the MediaWiki API.
+                       // Hm... perhaps all of Special:ViewXML should just
+                       // be replaced by an API action?
+                       if ( $requestedTitles ) {
+                               $pageNames = explode( '|', $requestedTitles );
+                               foreach ( $pageNames as $pageName ) {
+                                       $title = Title::newFromText( $pageName 
);
+                                       $text .= self::getXMLForPage( $title, 
$simplified_format, $groupings );
+                               }
+                       }
+
                        $text .= "</$pages_str>";
                        print $text;
                } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa04765f91000bfa1874ab12b2858a8c81527375
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataTransfer
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>

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

Reply via email to