Skip to content

Commit edabfc2

Browse files
committed
Remove unused function
1 parent 14d8c6d commit edabfc2

1 file changed

Lines changed: 0 additions & 28 deletions

File tree

backend/app/Services/Utils.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)