Add schema version param for API export.
authordaniel <dkinzler@wikimedia.org>
Mon, 17 Dec 2018 21:21:34 +0000 (22:21 +0100)
committerDaniel Kinzler <dkinzler@wikimedia.org>
Thu, 27 Jun 2019 21:57:05 +0000 (21:57 +0000)
Bug: T174031
Change-Id: I991809acf08563ffb71305d1df682d9e45b34831

includes/api/ApiQuery.php
includes/api/i18n/en.json
includes/api/i18n/qqq.json

index eeb0cf7..bdb0dc2 100644 (file)
@@ -441,6 +441,7 @@ class ApiQuery extends ApiBase {
                $exporter = new WikiExporter( $this->getDB() );
                $sink = new DumpStringOutput;
                $exporter->setOutputSink( $sink );
+               $exporter->setSchemaVersion( $this->mParams['exportschema'] );
                $exporter->openStream();
                foreach ( $exportTitles as $title ) {
                        $exporter->pageByTitle( $title );
@@ -479,6 +480,10 @@ class ApiQuery extends ApiBase {
                        'indexpageids' => false,
                        'export' => false,
                        'exportnowrap' => false,
+                       'exportschema' => [
+                               ApiBase::PARAM_DFLT => WikiExporter::schemaVersion(),
+                               ApiBase::PARAM_TYPE => XmlDumpWriter::$supportedSchemas,
+                       ],
                        'iwurl' => false,
                        'continue' => [
                                ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
index 9843af4..cae7687 100644 (file)
        "apihelp-query-param-indexpageids": "Include an additional pageids section listing all returned page IDs.",
        "apihelp-query-param-export": "Export the current revisions of all given or generated pages.",
        "apihelp-query-param-exportnowrap": "Return the export XML without wrapping it in an XML result (same format as [[Special:Export]]). Can only be used with $1export.",
+       "apihelp-query-param-exportschema": "Target the given version of the XML dump format when exporting. Can only be used with <var>$1export</var>.",
        "apihelp-query-param-iwurl": "Whether to get the full URL if the title is an interwiki link.",
        "apihelp-query-param-rawcontinue": "Return raw <samp>query-continue</samp> data for continuation.",
        "apihelp-query-example-revisions": "Fetch [[Special:ApiHelp/query+siteinfo|site info]] and [[Special:ApiHelp/query+revisions|revisions]] of <kbd>Main Page</kbd>.",
index 279c0c1..d5de23f 100644 (file)
        "apihelp-query-param-indexpageids": "{{doc-apihelp-param|query|indexpageids}}",
        "apihelp-query-param-export": "{{doc-apihelp-param|query|export}}",
        "apihelp-query-param-exportnowrap": "{{doc-apihelp-param|query|exportnowrap}}",
+       "apihelp-query-param-exportschema": "{{doc-apihelp-param|query|exportschema}}",
        "apihelp-query-param-iwurl": "{{doc-apihelp-param|query|iwurl}}",
        "apihelp-query-param-rawcontinue": "{{doc-apihelp-param|query|rawcontinue}}",
        "apihelp-query-example-revisions": "{{doc-apihelp-example|query}}",