Page MenuHomePhabricator

Translate characterEditStats.php script uses Revision::getQueryInfo
Closed, ResolvedPublic

Description

Seen in beta logstash: Use of Revision::getQueryInfo was deprecated in MediaWiki 1.31. [Called from CharacterEditStats::getRevisionsFromHistory]

relevant code:

// The field renames are to be compatible with recentchanges table query
if ( is_callable( [ Revision::class, 'getQueryInfo' ] ) ) {
	$revQuery = Revision::getQueryInfo( [ 'page' ] );
	$revUserText = $revQuery['fields']['rev_user_text'] ?? 'rev_user_text';
} else {
	$revQuery = [
		'tables' => [ 'revision', 'page' ],
		'joins' => [
			'page' => [ 'JOIN', 'rev_page = page_id' ],
		]
	];
	$revUserText = 'rev_user_text';
}

Should this just be updated to use RevisionStore? The is_callable check complicates things - is this meant to work once Revision is removed, and just needs to check the version as well? The replacement use of RevisionStore should always be available, so I'm not sure what to do about the logic in the else branch

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 triaged this task as High priority.EditedNov 2 2020, 8:37 AM
DannyS712 moved this task from Unsorted to Later on the User-DannyS712 board.

Use of hard-deprecated code -> high priority

How did this happen? Doesn't the deprecation policy prevent this?

The code can be updated to use methods that are present in 1.34 and later.

How did this happen? Doesn't the deprecation policy prevent this?

The code can be updated to use methods that are present in 1.34 and later.

I'm not sure how I missed this, sorry

As far as I know this script is only used in WMF production so we don't even need to worry about BC if it makes things easier. I think all other fallbacks have been removed already.

Change 676797 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/Translate@master] characterEditStats use RevisionStore service

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

Change 676797 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] characterEditStats use RevisionStore service

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

DannyS712 claimed this task.