Page MenuHomePhabricator

Prepare User creation methods for hard deprecation
Closed, DeclinedPublic

Description

The following methods in User are being replaced with UserFactory.

The goal of this task is to hard-deprecate the following methods:

  • public static function newFromName()
  • public static function newFromId()
  • public static function newFromActorId()
  • public static function newFromIdentity()
  • public static function newFromAnyId()
  • public static function newFromConfirmationCode()

Steps:

  1. use https://codesearch.wmcloud.org/search/ tool to find all the usages of these methods in extensions. Make a list, WMF deployed extensions separately, not WMF deployed extensions separately (you can select Wikimedia deployed) in the tool
  2. All usages of deprecated methods in the deployed extensions need to be replaced with corresponding UserFactory methods. You can obtain UserFactory via MediaWikiServices::getInstance()->getUserFactory(), but it's preferred to inject it if possible.
  3. Patches for all extensions that are not deployed should be created, but there's no requirement for them to get merged.

Event Timeline

Zabe triaged this task as Medium priority.May 6 2021, 10:50 AM
Zabe moved this task from Backlog to Deprecation on the User-Zabe board.

Can I suggest not just mass replacing with UserFactory if the uses are eventually going to be replaced with UserIdentityLookup or similar and migrated to UserIdentity/Authority?

Can I suggest not just mass replacing with UserFactory if the uses are eventually going to be replaced with UserIdentityLookup or similar and migrated to UserIdentity/Authority?

Yes, I need to agree on this one.

I'm boldly going to decline this. As written above we are widely switching over to UserIdentity and Authority, thus in the current situation doing this is a bit of a time waste.