Page MenuHomePhabricator

UploadStash accepts an optional user parameter and defaults to $wgUser
Closed, ResolvedPublic

Description

All known callers provide a user, except:

  1. FileRepo::getUploadStash accepts an optional user, defaulting to null, and passes that on
  2. UploadFromStash::__construct accepts an optional user, defaulting to false, and passes that on
  3. The cleanupUploadStash maintenance script doesn't pass a user
  4. UploadStashTest tests don't pass a user

See codesearch: https://codesearch.wmflabs.org/search/?q=new%20UploadStash%5C(&i=nope&files=&repos=

For #1
All known callers of FileRepo::getUploadStash already provide a user: https://codesearch.wmflabs.org/search/?q=getUploadStash%5C(&i=nope&files=&repos=

For #2
All known callers for UploadFromStash::__construct already provide a userhttps://codesearch.wmflabs.org/search/?q=UploadFromStash&i=nope&files=&repos=

For #3 and 4: Test will hide deprecation, script to be updated

Accordingly, not passing a user to the constructors of UploadStash or UploadFromStash, or to FileRepo::getUploadStash, should be hard deprecated

Event Timeline

DannyS712 triaged this task as Medium priority.Mar 3 2020, 4:54 AM
DannyS712 created this task.

Change 576182 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Deprecate not passing a user to UploadStash and its callers

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

Change 576182 abandoned by DannyS712:
[mediawiki/core@master] Deprecate not passing a user to UploadStash and its callers

Reason:
Unneeded, class is not safe for creation, should be done differently

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

Change 626894 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Provide a user to UploadStash

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

Change 626894 merged by jenkins-bot:
[mediawiki/core@master] UploadStash - fallback to RequestContext

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

DannyS712 removed a project: Patch-For-Review.

Alternatively, just use RequestContext