Fixes for check data

This commit is contained in:
David Bomba 2024-01-24 14:58:06 +11:00
parent f325370986
commit d73e05b5df
2 changed files with 15 additions and 4 deletions

View File

@ -922,6 +922,17 @@ class CheckData extends Command
}); });
Company::whereNull("subdomain")
->cursor()
->when(Ninja::isHosted())
->each(function ($c) {
$c->subdomain = MultiDB::randomSubdomainGenerator();
$c->save();
$this->logMessage("Fixing subdomain for # {$c->id}");
});
} }

View File

@ -557,9 +557,9 @@ class MultiDB
$current_db = config('database.default'); $current_db = config('database.default');
do { do {
$length = 8; $length = 10;
$string = ''; $string = '';
$vowels = ['a', 'e', 'i', 'o', 'u']; $vowels = ['a', 'e', 'i', 'o', 'u', 'y'];
$consonants = [ $consonants = [
'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm',
'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z',
@ -568,7 +568,7 @@ class MultiDB
$max = $length / 2; $max = $length / 2;
for ($i = 1; $i <= $max; $i++) { for ($i = 1; $i <= $max; $i++) {
$string .= $consonants[rand(0, 19)]; $string .= $consonants[rand(0, 19)];
$string .= $vowels[rand(0, 4)]; $string .= $vowels[rand(0, 5)];
} }
} while (! self::checkDomainAvailable($string)); } while (! self::checkDomainAvailable($string));