Last modified: 2014-05-31 12:44:45 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T54347, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 52347 - Use an IContextSource instead of globals
Use an IContextSource instead of globals
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
BookManagerv2 (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Kunal Mehta (Legoktm)
http://www.google-melange.com/gci/tas...
gci2013 https://www.mediawiki.org/wik...
: easy
Depends on:
Blocks: 50386
  Show dependency treegraph
 
Reported: 2013-07-31 20:23 UTC by Molly White
Modified: 2014-05-31 12:44 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Comment 1 Quim Gil 2013-12-03 22:30:31 UTC
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?
Comment 2 Kunal Mehta (Legoktm) 2013-12-03 22:34:32 UTC
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.
Comment 3 Quim Gil 2013-12-04 17:55:19 UTC
Thank you! Google Code-in task created.
Comment 4 Thomas Lam 2013-12-06 00:24:20 UTC
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?
Comment 5 Kunal Mehta (Legoktm) 2013-12-06 00:26:17 UTC
(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!
Comment 6 Gerrit Notification Bot 2013-12-06 00:37:56 UTC
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
Comment 7 Gerrit Notification Bot 2013-12-06 05:02:15 UTC
Change 99584 merged by jenkins-bot:
Use an IContextSource instead of globals in addDate method

https://gerrit.wikimedia.org/r/99584
Comment 8 Kunal Mehta (Legoktm) 2013-12-06 05:02:34 UTC
Thanks!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links