Avoid using User ::getCanonicalName

Remove using of User::getCanonicalName since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T275030
Change-Id: Ic11a4259271c8941225882ddce64b53d44280409
This commit is contained in:
vladshapik 2021-02-21 23:37:00 +02:00
parent a766d2e94f
commit 3f46a9b5c1

View file

@ -5,6 +5,7 @@ use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\RevisionAccessException;
use MediaWiki\Revision\RevisionLookup;
use MediaWiki\Revision\SlotRecord;
use MediaWiki\User\UserNameUtils;
use Wikimedia\IPUtils;
/**
@ -472,7 +473,8 @@ class SimpleCaptcha {
* @return string
*/
private function badLoginPerUserKey( $username, BagOStuff $cache ) {
$username = User::getCanonicalName( $username, 'usable' ) ?: $username;
$userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
$username = $userNameUtils->getCanonical( $username, UserNameUtils::RIGOR_USABLE ) ?: $username;
return $cache->makeGlobalKey(
'captcha', 'badlogin', 'user', md5( $username )