From b491279268fe1769a8787cbf30b5309c8aa91363 Mon Sep 17 00:00:00 2001 From: vladshapik Date: Fri, 16 Apr 2021 18:40:19 +0300 Subject: Hard Deprecate User ::getCanonicalName, ::isUsableName, ::isCreatableName Bug: T275030 Change-Id: I60689ee6519c2dbd6d000afa8ac05c3e6b7895d2 --- includes/user/ExternalUserNames.php | 4 +++- includes/user/User.php | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'includes/user') diff --git a/includes/user/ExternalUserNames.php b/includes/user/ExternalUserNames.php index f4afc8cec779..6727bae804aa 100644 --- a/includes/user/ExternalUserNames.php +++ b/includes/user/ExternalUserNames.php @@ -21,6 +21,7 @@ */ use MediaWiki\MediaWikiServices; +use MediaWiki\User\UserNameUtils; /** * Class to parse and build external user names @@ -105,7 +106,8 @@ class ExternalUserNames { * username), otherwise the name with the prefix prepended. */ public function applyPrefix( $name ) { - if ( User::getCanonicalName( $name, 'usable' ) === false ) { + $userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils(); + if ( $userNameUtils->getCanonical( $name, UserNameUtils::RIGOR_USABLE ) === false ) { return $name; } diff --git a/includes/user/User.php b/includes/user/User.php index 7fd97f193e7b..320ca3a7ff61 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1027,11 +1027,14 @@ class User implements Authority, IDBAccessObject, UserIdentity, UserEmailContact * If an account already exists in this form, login will be blocked * by a failure to pass this function. * - * @deprecated since 1.35, use the UserNameUtils service + * @deprecated since 1.35, use the UserNameUtils service. + * Hard deprecated since 1.37 + * * @param string $name Name to match * @return bool */ public static function isUsableName( $name ) { + wfDeprecated( __METHOD__, '1.35' ); return MediaWikiServices::getInstance()->getUserNameUtils()->isUsable( $name ); } @@ -1082,11 +1085,14 @@ class User implements Authority, IDBAccessObject, UserIdentity, UserEmailContact * Additional preventions may be added here rather than in * isValidUserName() to avoid disrupting existing accounts. * - * @deprecated since 1.35, use the UserNameUtils service + * @deprecated since 1.35, use the UserNameUtils service. + * Hard deprecated since 1.37 + * * @param string $name String to match * @return bool */ public static function isCreatableName( $name ) { + wfDeprecated( __METHOD__, '1.35' ); return MediaWikiServices::getInstance()->getUserNameUtils()->isCreatable( $name ); } @@ -1155,7 +1161,9 @@ class User implements Authority, IDBAccessObject, UserIdentity, UserEmailContact * Given unvalidated user input, return a canonical username, or false if * the username is invalid. * - * @deprecated since 1.35, use the UserNameUtils service + * @deprecated since 1.35, use the UserNameUtils service. + * Hard deprecated since 1.37 + * * @param string $name User input * @param string|bool $validate Type of validation to use: * - false No validation @@ -1167,6 +1175,7 @@ class User implements Authority, IDBAccessObject, UserIdentity, UserEmailContact * @return bool|string */ public static function getCanonicalName( $name, $validate = 'valid' ) { + wfDeprecated( __METHOD__, '1.35' ); // Backwards compatibility with strings / false $validationLevels = [ 'valid' => UserNameUtils::RIGOR_VALID, -- cgit v1.2.3