From f389d14b383fa71d862ac1360da601faad980bdf Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 28 Apr 2017 15:38:24 -0400 Subject: [PATCH] API: Deprecate diff and parse parameters in ApiQueryRevisionsBase 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 | 6 ++++++ includes/api/ApiQueryRevisionsBase.php | 16 ++++++++++++++++ includes/api/i18n/en.json | 14 +++++++------- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES-1.30 b/RELEASE-NOTES-1.30 index 0f5cb47a7c..122a21c90c 100644 --- a/RELEASE-NOTES-1.30 +++ b/RELEASE-NOTES-1.30 @@ -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 === * … diff --git a/includes/api/ApiQueryRevisionsBase.php b/includes/api/ApiQueryRevisionsBase.php index 696ec87867..2ffd02488b 100644 --- a/includes/api/ApiQueryRevisionsBase.php +++ b/includes/api/ApiQueryRevisionsBase.php @@ -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(), diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json index 5554105804..33a6072008 100644 --- a/includes/api/i18n/en.json +++ b/includes/api/i18n/en.json @@ -1105,15 +1105,15 @@ "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 $1).", + "apihelp-query+revisions+base-paramvalue-prop-parsetree": "Deprecated. Use [[Special:ApiHelp/expandtemplates|action=expandtemplates]] or [[Special:ApiHelp/parse|action=parse]] instead. The XML parse tree of revision content (requires content model $1).", "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 $1prop=parsetree).", - "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 [[Special:ApiHelp/expandtemplates|action=expandtemplates]] instead. Expand templates in revision content (requires $1prop=content).", + "apihelp-query+revisions+base-param-generatexml": "Use [[Special:ApiHelp/expandtemplates|action=expandtemplates]] or [[Special:ApiHelp/parse|action=parse]] instead. Generate XML parse tree for revision content (requires $1prop=content).", + "apihelp-query+revisions+base-param-parse": "Use [[Special:ApiHelp/parse|action=parse]] 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 prev, next and cur 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 $1diffto. If $1section 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 $1difftotext.", + "apihelp-query+revisions+base-param-diffto": "Use [[Special:ApiHelp/compare|action=compare]] instead. Revision ID to diff each revision to. Use prev, next and cur for the previous, next and current revision respectively.", + "apihelp-query+revisions+base-param-difftotext": "Use [[Special:ApiHelp/compare|action=compare]] instead. Text to diff each revision to. Only diffs a limited number of revisions. Overrides $1diffto. If $1section is set, only that section will be diffed against this text.", + "apihelp-query+revisions+base-param-difftotextpst": "Use [[Special:ApiHelp/compare|action=compare]] instead. Perform a pre-save transform on the text before diffing it. Only valid when used with $1difftotext.", "apihelp-query+revisions+base-param-contentformat": "Serialization format used for $1difftotext and expected for output of content.", "apihelp-query+search-description": "Perform a full text search.", -- 2.20.1