From 453ce03881758498da9125829f8505f92a2fcdf7 Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 23 Oct 2023 00:47:48 +0300 Subject: [PATCH] fix mod condition --- app/controllers/api/projects.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 6f2f4f40e3..d8d9f64681 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -124,7 +124,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)]; @@ -177,7 +177,8 @@ App::post('/v1/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]); + $database = $databases[$index]; + $project->setAttribute('database', $database); $dbForConsole->updateDocument('projects', $project); }