See parent task
@Daimona not claiming this since you already have https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/538706/ pending (with a number of dependencies) - do you want to claim this?
I've updated https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/538706/ to link to this task instead of the overall T159299
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 | Daimona | T246733 AbuseFilter needs uses of global $wgUser removed |
Event Timeline
Change 538706 had a related patch set uploaded (by DannyS712; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Kill the last use of wgUser
Would it be possible to use RequestContext::getMain()->getUser() while waiting for the abuse filter blockers to be clear?
Yes, but in terms of what the code is doing, I don't see any benefit in doing so. Note, it's not bad -- just useless (IMHO). It would still be using the global state, just in a way that looks prettier. Also, I hope to get the proper solution (T213006) done way before $wgUser will be hard-deprecated.
Change 626895 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/AbuseFilter@master] Reduce direct references to $wgUser
Change 626895 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Reduce direct references to $wgUser
While I know that there has been progress made on T213006, AbuseFilter is one of the few remaining deployed extensions that reads from $wgUser, and while using RequestContext::getMain() may just look prettier, it also allows the hard deprecation to move forward. The use of global state can be cleaned up later with proper injection. So, as a temporary measure, would you be okay with using RequestContext::getMain() ?
- If AbuseFilter is the only thing blocking the deprecation from moving forward then yes, we might switch to RequestContext::getMain; otherwise, I'd rather wait, in case T213006 is done before the other $wgUser consumers are updated;
- I'm not completely sure about what classes exactly are serialized in the DB, what methods these classes are using, etc. So, I think it might be possible to still have code that uses $wgUser even if we remove the use case in AFComputedVariable;
- Adding to 1), keep in mind that any patch touching that code is going to take some time to both the person writing the patch (that might be you), and to whoever has to manually rebase changes to that file. Unless that code is really the only blocker, I'm not sure it's worth the tradeoff
I do not oppose, I just want to make sure that we're not bikeshedding.
Change 538706 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Almost kill the last use of wgUser
Change 649391 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/AbuseFilter@master] AbuseFilterConsequencesTest: stop setting $wgUser
Change 649391 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] AbuseFilterConsequencesTest: stop setting $wgUser