Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T11968 Reduce use of global and public variables | |||
Open | None | T159283 Deprecate non-configuration globals | |||
Open | DannyS712 | T159299 Deprecate and remove $wgUser | |||
Resolved | DannyS712 | T267861 [GOAL] Emit deprecation warnings reading from $wgUser | |||
Resolved | DannyS712 | T245959 WMF deployed extensions need uses of global $wgUser removed [tracking] | |||
Resolved | Silvan_WMDE | T241947 Stop using $wgUser in Wikibase |
Event Timeline
Change 562066 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/Wikibase@master] tests: Stop using $wgUser
Change 562066 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] tests: Stop using $wgUser
I guess they could come from "Context".
I don't obviously see anything else in core that could be used at this second.
Which would mean something like:
RequestContext::getMain()->getUser()
In place of the global
Yeah, that's also the only alternative I can think of, given how early the entry point is executed. Given that RequestContext::getMain is almost the same as $wgUser, I'd suggest waiting; in case some new code introduces an alternative...
Well, RequestContext::getMain is slightly less evil that the global probably.
So I'd go for lets just make that patch and hen resolve this task for now :)
If someone wants to get rid of RequestContext::getMain then that is a whole different kettle of fish to tackle later down the line.
Yeah, well, a little bit... I believe the only difference is that, when using RequestContext, any piece of code writing to $wgUser and RequestContext::getMain only has to write to the latter. Aside from this, they're the same thing.
So I'd go for lets just make that patch and hen resolve this task for now :)
If someone wants to get rid of RequestContext::getMain then that is a whole different kettle of fish to tackle later down the line.
Sure :) In places where a User object can be injected, I believe that it's not worth it to use RequestContext::getMain now, and replace it with proper DI later. But, where there's no clear way to inject a User, I think RequestContext::getMain is acceptable.
Change 564975 had a related patch set uploaded (by Silvan Heintze; owner: Silvan Heintze):
[mediawiki/extensions/Wikibase@master] Replace global $wgUser with same user info from RequestContext
Change 564975 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Replace $wgUser with user from RequestContext