Page MenuHomePhabricator

RequestContext setUser should also set wgUser
Closed, DeclinedPublic

Description

In the parent task, efforts are being made to reduce reading of $wgUser in favor of accessing the request context.
Until all reads are removed, however, writing to $wgUser is being kept, since any subsequent reads need to know the correct user.

As a temporary measure, I propose that, when setting the context user, the global $wgUser also be set

Event Timeline

DannyS712 triaged this task as Medium priority.Jan 16 2020, 6:25 PM
DannyS712 created this task.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 565360 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Have RequestContext::setUser write to $wgUser, add temporary override

https://gerrit.wikimedia.org/r/565360

This would also help with methods that currently need to set both context ->setUser and manually set $wgUser, like

  • CentralAuth`s DeleteEmptyAccounts
  • MassMessage's MassMessageJob
  • WebDAV's validateUserPass and WebDAVTokenAuthBackend
  • AzharAuth's SpecialAzharAuth
  • BlueSpiceSocial's RebuildEntities
  • OAuthAuthentication's SpecialOAuthLogin

Hmm, causes test failures because $wgUser is written to separately?

@DannyS712: Assuming this task is about MediaWiki-General, hence adding project tag so others can find this task when searching for tasks under that project.

Change 565360 abandoned by DannyS712:
Have RequestContext::setUser write to $wgUser, add temporary override

Reason:
Not a good idea

https://gerrit.wikimedia.org/r/565360