File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,34 +119,6 @@ public static function getUniqueName(string $name, bool $cacheUsers=false): stri
119119 return $ uniqueName ;
120120 }
121121
122- /**
123- * Returns a unique name for a user (DO NOT USE, only migration code)
124- */
125- public static function getUniqueNameCached (string $ name ): string
126- {
127- static $ used = [];
128-
129- $ uniqueName ??= $ name ;
130- $ uniqueName = preg_replace ('([^a-zA-Z0-9-_]) ' , '' , strtolower ($ uniqueName ));
131- if (strlen ($ uniqueName ) == 0 ) {
132- $ uniqueName = 'mws ' ;
133- }
134-
135- //Try to make a unique name for the user
136- $ num = null ;
137- $ found = false ;
138- while (!$ found ) {
139- $ current = $ uniqueName .(isset ($ num ) ? '- ' .$ num : '' );
140- if (!isset ($ used [$ current ])) {
141- $ used [$ current ] = true ;
142- return $ current ;
143- } else {
144- $ num ??= 0 ;
145- $ num ++;
146- }
147- }
148- }
149-
150122 /**
151123 * Restores user's bans, warnings and social logins in order to prevent users from (too easily) evading bans.
152124 * Why the too easy? Obviously, it's not too hard to fool the system and it's impossible to have a perfect system.
You can’t perform that action at this time.
0 commit comments