1
0
Fork 0
mirror of synced 2024-07-03 21:50:34 +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'];
$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) {
unset($databases[$index]);
}
@ -178,9 +179,9 @@ App::post('/v1/projects')
* Update database with self-managed db every $mod projects
*/
$mod = 20;
if ($project->getInternalId() % $mod === 0) {
$database = 'database_db_fra1_self_hosted_0_0';
$project->setAttribute('database', $database);
$index = in_array($databaseSelfHosted, $databases);
if ($project->getInternalId() % $mod === 0 && $index !== false) {
$project->setAttribute('database', $databaseSelfHosted);
$dbForConsole->updateDocument('projects', $project);
}