fix mod condition
This commit is contained in:
parent
0d5127d90b
commit
ac231914d4
1 changed files with 8 additions and 5 deletions
|
@ -100,7 +100,10 @@ App::post('/v1/projects')
|
|||
$backups['database_db_fra1_v14x_07'] = ['from' => '00:00', 'to' => '02:00'];
|
||||
|
||||
$databases = Config::getParam('pools-database', []);
|
||||
|
||||
$index = array_search('database_db_fra1_self_hosted_0_0', $databases);
|
||||
if ($index !== false) {
|
||||
unset($databases[$index]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove databases from the list that are currently undergoing an backup
|
||||
|
@ -124,7 +127,7 @@ App::post('/v1/projects')
|
|||
|
||||
$databaseOverride = App::getEnv('_APP_DATABASE_OVERRIDE', null);
|
||||
$index = array_search($databaseOverride, $databases);
|
||||
if ($index) {
|
||||
if ($index !== false) {
|
||||
$database = $databases[$index];
|
||||
} else {
|
||||
$database = $databases[array_rand($databases)];
|
||||
|
@ -175,9 +178,9 @@ App::post('/v1/projects')
|
|||
* Update database with self-managed db every $mod projects
|
||||
*/
|
||||
$mod = 20;
|
||||
$index = array_search('database_db_fra1_self_hosted_0_0', $databases);
|
||||
if ($index !== false && ($project->getInternalId() % $mod === 0)) {
|
||||
$project->setAttribute('database', $databases[$index]);
|
||||
if ($project->getInternalId() % $mod === 0) {
|
||||
$database = 'database_db_fra1_self_hosted_0_0';
|
||||
$project->setAttribute('database', $database);
|
||||
$dbForConsole->updateDocument('projects', $project);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue