Index: AntiSpoof.i18n.php =================================================================== --- AntiSpoof.i18n.php (revision 39622) +++ AntiSpoof.i18n.php (working copy) @@ -9,8 +9,9 @@ $messages['en'] = array( 'antispoof-desc' => 'Blocks the creation of accounts with mixed-script, confusing and similar usernames', - 'antispoof-name-conflict' => 'The name "$1" is too similar to the existing account "$2". -Please choose another name.', + 'antispoof-conflict-top' => 'The name "$1" is too similar to {{PLURAL:$2|the existing account|the following $2 accounts}}:', + 'antispoof-conflict-item' => '$1', + 'antispoof-conflict-bottom' => 'Please choose another name.', 'antispoof-name-illegal' => 'The name "$1" is not allowed to prevent confusing or spoofed usernames: $2. Please choose another name.', 'antispoof-badtype' => 'Bad data type', Index: AntiSpoof.php =================================================================== --- AntiSpoof.php (revision 39622) +++ AntiSpoof.php (working copy) @@ -81,13 +81,19 @@ $spoof = new SpoofUser( $name ); if( $spoof->isLegal() ) { $normalized = $spoof->getNormalized(); - $conflict = $spoof->getConflict(); - if( $conflict === false ) { + $conflicts = $spoof->getConflicts(); + if( empty($conflicts) ) { wfDebugLog( 'antispoof', "{$mode}PASS new account '$name' [$normalized]" ); } else { - wfDebugLog( 'antispoof', "{$mode}CONFLICT new account '$name' [$normalized] spoofs '$conflict'" ); + wfDebugLog( 'antispoof', "{$mode}CONFLICT new account '$name' [$normalized] spoofs " . implode( ',', $conflicts ) ); if( $active ) { - $message = wfMsg( 'antispoof-name-conflict', $name, $conflict ); + $numConflicts = count( $conflicts ); + $message = wfMsgExt( 'antispoof-conflict-top', array('parsemag'), $name, $numConflicts ); + $message .= '' . wfMsg( 'antispoof-conflict-bottom' ); return false; } } Index: SpoofUser.php =================================================================== --- SpoofUser.php (revision 39622) +++ SpoofUser.php (working copy) @@ -39,31 +39,30 @@ /** * Does the username pass Unicode legality and script-mixing checks? * - * @return mixed false if no conflict, or string with conflicting username + * @return array empty if no conflict, or array containing conflicting usernames */ - public function getConflict() { - if( $this->isLegal() ) { - $dbr = wfGetDB( DB_SLAVE ); + public function getConflicts() { + $dbr = wfGetDB( DB_SLAVE ); - // Join against the user table to ensure that we skip stray - // entries left after an account is renamed or otherwise munged. - $row = $dbr->selectRow( - array( 'spoofuser', 'user' ), - array( 'user_name' ), - array( - 'su_normalized' => $this->mNormalized, - 'su_name=user_name', - ), - __METHOD__ ); + // Join against the user table to ensure that we skip stray + // entries left after an account is renamed or otherwise munged. + $spoofedUsers = $dbr->select( + array( 'spoofuser', 'user' ), + array( 'user_name' ), + array( + 'su_normalized' => $this->mNormalized, + 'su_name=user_name', + ), + __METHOD__, + array( + 'LIMIT' => 5 + ) ); - if( $row ) { - return $row->user_name; - } else { - return false; - } - } else { - return false; + $spoofs = array(); + while( $row = $dbr->fetchObject( $spoofedUsers ) ) { + array_push( $spoofs, $row->user_name ); } + return $spoofs; } /**