1
0
Fork 0
mirror of synced 2024-07-06 07:00:56 +12:00

fix mod condition

This commit is contained in:
shimon 2023-10-23 01:05:10 +03:00
parent ac231914d4
commit a841734d50

View file

@ -100,7 +100,8 @@ App::post('/v1/projects')
$backups['database_db_fra1_v14x_07'] = ['from' => '00:00', 'to' => '02:00']; $backups['database_db_fra1_v14x_07'] = ['from' => '00:00', 'to' => '02:00'];
$databases = Config::getParam('pools-database', []); $databases = Config::getParam('pools-database', []);
$index = array_search('database_db_fra1_self_hosted_0_0', $databases); $databaseSelfHosted = 'database_db_fra1_self_hosted_0_0';
$index = array_search($databaseSelfHosted, $databases);
if ($index !== false) { if ($index !== false) {
unset($databases[$index]); unset($databases[$index]);
} }
@ -178,9 +179,9 @@ App::post('/v1/projects')
* Update database with self-managed db every $mod projects * Update database with self-managed db every $mod projects
*/ */
$mod = 20; $mod = 20;
if ($project->getInternalId() % $mod === 0) { $index = in_array($databaseSelfHosted, $databases);
$database = 'database_db_fra1_self_hosted_0_0'; if ($project->getInternalId() % $mod === 0 && $index !== false) {
$project->setAttribute('database', $database); $project->setAttribute('database', $databaseSelfHosted);
$dbForConsole->updateDocument('projects', $project); $dbForConsole->updateDocument('projects', $project);
} }