Page MenuHomePhabricator

Use an IContextSource instead of globals
Closed, ResolvedPublic

Details

Reference
bz52347

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 2:09 AM
bzimport set Reference to bz52347.
bzimport created this task.Jul 31 2013, 8:23 PM
Qgil added a comment.Dec 3 2013, 10:30 PM

I m happy to submit this bug as a Google Code-in task. However, in its current status it is quite cryptic for a newcomer. There is only a link to a patch merged with some comments around.

Can you add a proper description of the bug, please?

That function uses $wgLang and $wgUser, which are evil globals.

Each parent caller (through various functions) provides context, which is some object that implements IContextSource. The code should simply pass the context down and use $context->getLanguage() and $context->getUser() instead of relying on globals.

Qgil added a comment.Dec 4 2013, 5:55 PM

Thank you! Google Code-in task created.

t.lam wrote:

so is what I need to do just add $context as a parameter for the method and use the context's methods to get the variables?

(In reply to comment #4)

so is what I need to do just add $context as a parameter for the method and
use
the context's methods to get the variables?

Basically yup!

Change 99584 had a related patch set uploaded by Tholam:
Use an IContextSource instead of globals in addDate method

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

Change 99584 merged by jenkins-bot:
Use an IContextSource instead of globals in addDate method

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