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 updated the task description. (Show Details)
Umherirrender raised the priority of this task from to Needs Triage.
Umherirrender added a subscriber: Umherirrender.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 12 2015, 7:50 PM

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.

This comment was removed by NeerajBattan.
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptFeb 29 2016, 9:26 PM

[ 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 removed Harjotsingh as the assignee of this task.Sep 11 2016, 9:04 PM
Legoktm added a subscriber: Legoktm.

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

Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptSep 11 2016, 9:04 PM

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

amritsreekumar closed this task as Resolved.Nov 27 2016, 3:05 AM

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

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