API: Deprecate diff and parse parameters in ApiQueryRevisionsBase
authorBrad Jorsch <bjorsch@wikimedia.org>
Fri, 28 Apr 2017 19:38:24 +0000 (15:38 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Fri, 16 Jun 2017 16:01:44 +0000 (12:01 -0400)
The 'rvdifftotext', 'rvdifftotextpst', 'rvdiffto', 'rvexpandtemplates',
'rvgeneratexml', 'rvparse', and 'rvprop=parsetree' parameters to
prop=revisions are deprecated, as are the similarly named parameters to
prop=deletedrevisions, list=allrevisions, and list=alldeletedrevisions.

Use action=compare, action=parse, or action=expandtemplates instead.

Bug: T164106
Change-Id: I6deaf550a4b96f0d35488bea7bfd6637d6d1c36a

RELEASE-NOTES-1.30
includes/api/ApiQueryRevisionsBase.php
includes/api/i18n/en.json

index 0f5cb47..122a21c 100644 (file)
@@ -70,6 +70,12 @@ production.
   formatted as specified by the error formatter parameters.
 * action=compare can now handle arbitrary text, deleted revisions, and
   returning users and edit comments.
+* (T164106) The 'rvdifftotext', 'rvdifftotextpst', 'rvdiffto',
+  'rvexpandtemplates', 'rvgeneratexml', 'rvparse', and 'rvprop=parsetree'
+  parameters to prop=revisions are deprecated, as are the similarly named
+  parameters to prop=deletedrevisions, list=allrevisions, and
+  list=alldeletedrevisions. Use action=compare, action=parse, or
+  action=expandtemplates instead.
 
 === Action API internal changes in 1.30 ===
 * …
index 696ec87..2ffd024 100644 (file)
@@ -104,6 +104,17 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
                $this->fld_tags = isset( $prop['tags'] );
                $this->fld_parsetree = isset( $prop['parsetree'] );
 
+               if ( $this->fld_parsetree ) {
+                       $encParam = $this->encodeParamName( 'prop' );
+                       $name = $this->getModuleName();
+                       $parent = $this->getParent();
+                       $parentParam = $parent->encodeParamName( $parent->getModuleManager()->getModuleGroup( $name ) );
+                       $this->addDeprecation(
+                               [ 'apiwarn-deprecation-parameter', "{$encParam}=parsetree" ],
+                               "action=query&{$parentParam}={$name}&{$encParam}=parsetree"
+                       );
+               }
+
                if ( !empty( $params['contentformat'] ) ) {
                        $this->contentFormat = $params['contentformat'];
                }
@@ -477,6 +488,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
                        'expandtemplates' => [
                                ApiBase::PARAM_DFLT => false,
                                ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-expandtemplates',
+                               ApiBase::PARAM_DEPRECATED => true,
                        ],
                        'generatexml' => [
                                ApiBase::PARAM_DFLT => false,
@@ -486,19 +498,23 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
                        'parse' => [
                                ApiBase::PARAM_DFLT => false,
                                ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-parse',
+                               ApiBase::PARAM_DEPRECATED => true,
                        ],
                        'section' => [
                                ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-section',
                        ],
                        'diffto' => [
                                ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-diffto',
+                               ApiBase::PARAM_DEPRECATED => true,
                        ],
                        'difftotext' => [
                                ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-difftotext',
+                               ApiBase::PARAM_DEPRECATED => true,
                        ],
                        'difftotextpst' => [
                                ApiBase::PARAM_DFLT => false,
                                ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-difftotextpst',
+                               ApiBase::PARAM_DEPRECATED => true,
                        ],
                        'contentformat' => [
                                ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(),
index 5554105..33a6072 100644 (file)
        "apihelp-query+revisions+base-paramvalue-prop-parsedcomment": "Parsed comment by the user for the revision.",
        "apihelp-query+revisions+base-paramvalue-prop-content": "Text of the revision.",
        "apihelp-query+revisions+base-paramvalue-prop-tags": "Tags for the revision.",
-       "apihelp-query+revisions+base-paramvalue-prop-parsetree": "The XML parse tree of revision content (requires content model <code>$1</code>).",
+       "apihelp-query+revisions+base-paramvalue-prop-parsetree": "<span class=\"apihelp-deprecated\">Deprecated.</span> Use <kbd>[[Special:ApiHelp/expandtemplates|action=expandtemplates]]</kbd> or <kbd>[[Special:ApiHelp/parse|action=parse]]</kbd> instead. The XML parse tree of revision content (requires content model <code>$1</code>).",
        "apihelp-query+revisions+base-param-limit": "Limit how many revisions will be returned.",
-       "apihelp-query+revisions+base-param-expandtemplates": "Expand templates in revision content (requires $1prop=content).",
-       "apihelp-query+revisions+base-param-generatexml": "Generate XML parse tree for revision content (requires $1prop=content; replaced by <kbd>$1prop=parsetree</kbd>).",
-       "apihelp-query+revisions+base-param-parse": "Parse revision content (requires $1prop=content). For performance reasons, if this option is used, $1limit is enforced to 1.",
+       "apihelp-query+revisions+base-param-expandtemplates": "Use <kbd>[[Special:ApiHelp/expandtemplates|action=expandtemplates]]</kbd> instead. Expand templates in revision content (requires $1prop=content).",
+       "apihelp-query+revisions+base-param-generatexml": "Use <kbd>[[Special:ApiHelp/expandtemplates|action=expandtemplates]]</kbd> or <kbd>[[Special:ApiHelp/parse|action=parse]]</kbd> instead. Generate XML parse tree for revision content (requires $1prop=content).",
+       "apihelp-query+revisions+base-param-parse": "Use <kbd>[[Special:ApiHelp/parse|action=parse]]</kbd> instead. Parse revision content (requires $1prop=content). For performance reasons, if this option is used, $1limit is enforced to 1.",
        "apihelp-query+revisions+base-param-section": "Only retrieve the content of this section number.",
-       "apihelp-query+revisions+base-param-diffto": "Revision ID to diff each revision to. Use <kbd>prev</kbd>, <kbd>next</kbd> and <kbd>cur</kbd> for the previous, next and current revision respectively.",
-       "apihelp-query+revisions+base-param-difftotext": "Text to diff each revision to. Only diffs a limited number of revisions. Overrides <var>$1diffto</var>. If <var>$1section</var> is set, only that section will be diffed against this text.",
-       "apihelp-query+revisions+base-param-difftotextpst": "Perform a pre-save transform on the text before diffing it. Only valid when used with <var>$1difftotext</var>.",
+       "apihelp-query+revisions+base-param-diffto": "Use <kbd>[[Special:ApiHelp/compare|action=compare]]</kbd> instead. Revision ID to diff each revision to. Use <kbd>prev</kbd>, <kbd>next</kbd> and <kbd>cur</kbd> for the previous, next and current revision respectively.",
+       "apihelp-query+revisions+base-param-difftotext": "Use <kbd>[[Special:ApiHelp/compare|action=compare]]</kbd> instead. Text to diff each revision to. Only diffs a limited number of revisions. Overrides <var>$1diffto</var>. If <var>$1section</var> is set, only that section will be diffed against this text.",
+       "apihelp-query+revisions+base-param-difftotextpst": "Use <kbd>[[Special:ApiHelp/compare|action=compare]]</kbd> instead. Perform a pre-save transform on the text before diffing it. Only valid when used with <var>$1difftotext</var>.",
        "apihelp-query+revisions+base-param-contentformat": "Serialization format used for <var>$1difftotext</var> and expected for output of content.",
 
        "apihelp-query+search-description": "Perform a full text search.",