Last modified: 2014-08-11 17:33:06 UTC
Tim said we can phase out $wgUser in favor of RequestContext::getMain()->getUser() https://www.facebook.com/brionv/posts/10151391376376852 We could use a PHP CodeSniffer sniff to report $wgUser should be replaced.
Don't we already have a deprecation system in general? (both for methods and for globals). How is phpcs relevant? With the proper configuration, accessing deprecated methods or globals, a PHP error is emitted.
And what is the "proper" configuration to react whenever $wgUser is referenced / accessed ?
(In reply to comment #2) > And what is the "proper" configuration to react whenever $wgUser is > referenced / accessed ? The proper solution is to assert that no php errors/notices are emitted during our running of the installer, php unit tests and http requests. Marking as wontfix and suggest further discussion be at bug 48002.
Timo that is not covering everything. We want to get rid of $wgUser and the easiest is to detect whether it is used in the code, a sniff is a trivial thing to add in.
Related URL: https://gerrit.wikimedia.org/r/69090 (Gerrit Change Ic3d5f082afefe761a24ab0822859a9ef88c61e02)
Created attachment 12564 [details] FB preview (In reply to comment #0) > https://www.facebook.com/brionv/posts/10151391376376852 Attaching for posterity's sake.
Umherirrender notified on the change: ----- There is a DeprecatedGlobals.php to get deprecation warnings on a global (used for $wgArticle), but $wgUser is not deprecated at the moment, so this is only for a hint to the developer and should not be a blocking sniff. ----- So I guess that needs to be done directly in core instead of phpcs as Timo pointed out. Moving bugs under MediaWiki product.
Change 69090 abandoned by Hashar: Implement DeprecatedGlobalSniff for $wgUser Reason: I do not knew about DeprecatedGlobals.php seems it would get the job done. I have moved the bug report https://bugzilla.wikimedia.org/show_bug.cgi?id=48963 under MediaWiki product. https://gerrit.wikimedia.org/r/69090
There is no patch pending. Reseting bug status.
What is this DeprecatedGlobals.php file?
The following patch is probably rather relevant. https://gerrit.wikimedia.org/r/#/c/153399/