Page MenuHomePhabricator

PageArchive::undelete falls back to $wgUser
Closed, ResolvedPublic

Description

There are so few calls it should be pretty simple to move the $user parameter to first, since all of the parameters are currently optional. Alternatively, would it be clearer/easier to create ::undeleteAsUser and deprecate calling ::undelete?

Event Timeline

DannyS712 moved this task from Unsorted to Next on the User-DannyS712 board.

Tagging CPT to review which method of requiring a user would be better (moving the parameter to 1st or a new method)

PageArchive::undelete is used by several extensions. A breaking change to the method signature is not advisable. Eventually, the entire class should probably be turned into a service.

Introducing undeleteAsUser and (soft-)deprecating the old undelete method seems like the smoothest transition, though it leaves us with a clunky method name. The alternative is to wait until we turn the entire class into a service.

PageArchive::undelete is used by several extensions. A breaking change to the method signature is not advisable. Eventually, the entire class should probably be turned into a service.

Introducing undeleteAsUser and (soft-)deprecating the old undelete method seems like the smoothest transition, though it leaves us with a clunky method name. The alternative is to wait until we turn the entire class into a service.

I'm going to go with undeleteAsUser:

  • Introduce new method, soft deprecate old
  • Replace deployed uses
  • Hard deprecate ::undelete
  • Replace remaining uses
  • Remove

I'm going to try to get through hard deprecation before 1.35 is cut

Change 580984 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Introduce PageArchive::undeleteAsUser, soft deprecate ::undelete

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

Patch pending for introduction, once its merged will start updating extensions

Change 580984 merged by jenkins-bot:
[mediawiki/core@master] Introduce PageArchive::undeleteAsUser, soft deprecate ::undelete

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

Code search: https://codesearch.wmflabs.org/search/?q=-%3Eundelete%5C(&i=nope&files=&repos=
For extensions that support multiple versions, can use: if ( method_exists( $pageArchive, 'undeleteAsUser' ) ) { to branch

Change 581026 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Make use of PageArchive::undeleteAsUser

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

Change 581029 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/Cognate@master] Make use of PageArchive::undeleteAsUser when possible

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

Change 581030 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/CreatedPagesList@master] Make use of PageArchive::undeleteAsUser when possible

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

Change 581034 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/PhpTagsStorage@master] Make use of PageArchive::undeleteAsUser when possible

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

Change 581037 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/Video@master] Make use of PageArchive::undeleteAsUser when possible

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

Patches submitted for all extensions, but only core and cognate need to be updated before hard deprecation can occur

Change 581029 merged by jenkins-bot:
[mediawiki/extensions/Cognate@master] Make use of PageArchive::undeleteAsUser when possible

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

Change 581030 merged by jenkins-bot:
[mediawiki/extensions/CreatedPagesList@master] Make use of PageArchive::undeleteAsUser when possible

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

Change 581026 merged by jenkins-bot:
[mediawiki/core@master] Make use of PageArchive::undeleteAsUser

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

Change 581608 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Hard deprecate PageArchive::undelete

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

Change 581037 merged by jenkins-bot:
[mediawiki/extensions/Video@master] Make use of PageArchive::undeleteAsUser when possible

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

@Pchelolo the core hard deprecation should be ready to go, since PhpTagsStorage isn't deployed (isn't merging because of unrelated test failures). Can you merge it so that it can then be removed in 1.36? Thanks

Change 581608 merged by jenkins-bot:
[mediawiki/core@master] Hard deprecate PageArchive::undelete

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

Change 581034 merged by Ppchelko:
[mediawiki/extensions/PhpTagsStorage@master] Make use of PageArchive::undeleteAsUser when possible

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