This task specifically targets the reduction of RequestContext::getMain outside test code. There are 93 files using RequestContext at the moment:
https://codesearch.wmcloud.org/core/?q=RequestContext%3A%3AgetMain&files=%5C.php&excludeFiles=phpunit
After a quick pass to identify cases where the reference can easily be deprecated or removed, a next step would be to group the remaining use cases to identify how problematic the reference is, and potentially what one would to do to remove the global context reference.
If a class is touched, we should be careful with regard to hook runners, where an extension may read from RequestContext.
I have identified the following callsites as likely simple to adjust, but did not create a change yet (mostly because I want my number of concurrent patchsets overseeable)
- SpecialPageFactory::getUsablePages: Few callers, simple to migrate
- UploadBase::checkWarnings: Few callers, simple to migrate
- UploadBase::isValidRequest: should take a user parameter, which is available at the callers
- ... (feel free to add things here)
See also: T290706: Parser code for special page transclusion replaces main context