Page MenuHomePhabricator

Use an IContextSource instead of globals
Closed, ResolvedPublic

Details

Reference
bz52347

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:09 AM
bzimport set Reference to bz52347.

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.

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