Page MenuHomePhabricator

ChangeTags::buildTagFilterSelector needs a context
Closed, ResolvedPublic

Description

ChangeTags::buildTagFilterSelector is using wfMessage which results in use of global $wgTitle. It also using a config variable as global

A IContextSource should be added as parameter to this static function, which can be used to avoid the globals

Event Timeline

Umherirrender raised the priority of this task from to Needs Triage.
Umherirrender updated the task description. (Show Details)
Umherirrender added a subscriber: Umherirrender.

I cannot understand which repo this issue belongs to. I am new at this and it would be great if you could help

@Saptak013: Thanks for your interest! This is part of the MediaWiki core repository in Git/Gerrit. The file includes/changetags/ChangeTags.php should be related.

[ Please do not remove your comments in Phabricator if there is no good reason to do so. Thanks. ]

Aklapper: Sorry, actually I got the answer to my question that's why I removed my comment.

ChangeTags::buildTagFilterSelector has global $wgUseTagFilter and $wgTitle doesn't exists.
Is the task only adding IContextSource as parameter to this function ?

The $wgTitle is not used directly, but the use of wfMessage results in a use of $wgTitle inside wfMessage (as written in the description)

Yes, this task is about adding the ContextSource to the function

@Umherirrender What I wanted to know was that if the task is to change instances of wfMessage with IContextSource in buildTagFilterSelectorChangeTags.php or simply add IContextSource as a parameter to the function?

Adding a IContextSource without replacement inside the code seems not very helpful, so yes, please change the global to use the context->getConfig->get and replace wfMessage to context->msg.

All callers should be updated, but also old callers of that function must work, so fall back to RequestContext::getMain, when the new added parameter is not set.

I see this bug is subtask of https://phabricator.wikimedia.org/T71084.
I'll work on this and change instances of wfMessage in buildTagFilterSelector.

Legoktm added a subscriber: Legoktm.

I think this whole class needs refactoring to split the DB logic and presentation details.

Change 316063 had a related patch set uploaded (by Amritsreekumar):
ChangeTags::buildTagFilterSelector needs a context

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

Change 316063 merged by jenkins-bot:
Add a context to ChangeTags::buildTagFilterSelector

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

Change 316836 merged by jenkins-bot:
Provide context to ChangeTags::buildTagFilterSelector

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