GenderCache: remove checking for valid usernames
Violates proper DI by retrieving UserNameUtils from MediaWikiServices instead of injecting, but can't inject because that creates a circular dependency (UsernameUtils indirectly relies on GenderCache via MediaWikiTitleCodec). If callers can validate that they are only searching for the genders of valid user names, that would be great but its not required, at worst we just search for a few extra database rows that don't exist. Bug: T267054 Change-Id: I00813228e177a7a7d13969fae85cf725def8f879
This commit is contained in:
parent
675694308c
commit
ba2e216399
1 changed files with 2 additions and 5 deletions
7
includes/cache/GenderCache.php
vendored
7
includes/cache/GenderCache.php
vendored
|
|
@ -150,7 +150,6 @@ class GenderCache {
|
|||
*/
|
||||
public function doQuery( $users, $caller = '' ) {
|
||||
$default = $this->getDefault();
|
||||
$userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
|
||||
|
||||
$usersToCheck = [];
|
||||
foreach ( (array)$users as $value ) {
|
||||
|
|
@ -159,10 +158,8 @@ class GenderCache {
|
|||
if ( !isset( $this->cache[$name] ) ) {
|
||||
// For existing users, this value will be overwritten by the correct value
|
||||
$this->cache[$name] = $default;
|
||||
// query only for valid names, which can be in the database
|
||||
if ( $userNameUtils->isValid( $name ) ) {
|
||||
$usersToCheck[] = $name;
|
||||
}
|
||||
// We no longer verify that only valid names are checked for, T267054
|
||||
$usersToCheck[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue