Page MenuHomePhabricator

ext.translate.special.pagepreparation.js makes a MW API query that results in a deprecated warning
Closed, ResolvedPublic

Description

	function getDiff( pageName, pageContent ) {
		var api = new mw.Api();

		return api.post( {
			action: 'query',
			prop: 'revisions',
			rvprop: 'content',
			rvlimit: '1',
			titles: pageName,
			rvdifftotext: pageContent
		} ).then( function ( data ) {
			var obj;
			for ( var page in data.query.pages ) {
				obj = data.query.pages[ page ];
			}

			var diff;
			if ( obj !== undefined ) {
				diff = obj.revisions[ 0 ].diff[ '*' ];
			}

			return diff;
		} );
	}

Deprecated since MW 1.30; rMWf389d14b383f: API: Deprecate diff and parse parameters in ApiQueryRevisionsBase.

{
	"batchcomplete": "",
	"warnings": {
		"main": {
			"*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes. Use [[Special:ApiFeatureUsage]] to see usage of deprecated features by your application."
		},
		"revisions": {
			"*": "The parameter \"rvdifftotext\" has been deprecated.\nBecause \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
		}
	}
}

That warning is probably not the most helpful; we really don't just want to pass rvslots.

If we look at https://www.mediawiki.org/w/api.php?action=help&modules=query%2Brevisions

rvdifftotext
    Deprecated.

    Use action=compare instead. Text to diff each revision to. Only diffs a limited number of revisions. Overrides rvdiffto. If rvsection is set, only that section will be diffed against this text.

action=compare should probably be used instead. It has existed since rMWc8079f0b81fe: * (bug 27185) API: Add Special:ComparePages in T29185: API: Add Special:ComparePages from 2011, so shouldn't be any issues with MLEB back compat etc.

Event Timeline

Change 941422 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/Translate@master] ext.translate.special.pagepreparation.js: Use action=compare

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

Change 941422 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] ext.translate.special.pagepreparation.js: Use action=compare

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

Change 941874 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/Translate@REL1_40] ext.translate.special.pagepreparation.js: Use action=compare

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

Change 941875 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/Translate@REL1_39] ext.translate.special.pagepreparation.js: Use action=compare

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

Reedy claimed this task.

Change 941875 merged by jenkins-bot:

[mediawiki/extensions/Translate@REL1_39] ext.translate.special.pagepreparation.js: Use action=compare

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

Change 941874 merged by jenkins-bot:

[mediawiki/extensions/Translate@REL1_40] ext.translate.special.pagepreparation.js: Use action=compare

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