From fb802c7fe4a0555807e0608de67f106c72ca74aa Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 10 Apr 2025 18:35:45 +0300 Subject: [PATCH] addressing comments --- app/controllers/api/proxy.php | 8 ++++---- src/Appwrite/Platform/Tasks/Maintenance.php | 22 ++++++++++++--------- src/Appwrite/Platform/Workers/Deletes.php | 22 ++++++++++----------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/app/controllers/api/proxy.php b/app/controllers/api/proxy.php index 7ee2fa1dee..80f3df2605 100644 --- a/app/controllers/api/proxy.php +++ b/app/controllers/api/proxy.php @@ -62,13 +62,13 @@ App::post('/v1/proxy/rules') } $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS'); - $denyListString = System::getEnv('_APP_CUSTOM_DOMAIN_DENY_LIST'); + $denyListDomains = System::getEnv('_APP_CUSTOM_DOMAIN_DENY_LIST'); - if (!empty($functionsDomain)) { - $denyListString .= ',' . $functionsDomain; + if (!empty($denyListDomains)) { + $functionsDomain .= ',' . $denyListDomains; } - $deniedDomains = array_map('trim', explode(',', $denyListString)); + $deniedDomains = array_map('trim', explode(',', $functionsDomain)); foreach ($deniedDomains as $deniedDomain) { if (str_ends_with($domain, $deniedDomain)) { diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index b8e23223e0..62f504acf0 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -47,18 +47,22 @@ class Maintenance extends Action Console::info("[{$time}] Notifying workers with maintenance tasks every {$interval} seconds"); - $dbForPlatform->foreach('projects', [ + $dbForPlatform->foreach( + 'projects', + [ Query::equal('region', System::getEnv('_APP_REGION', 'default')) ], function (Document $project) use ($queueForDeletes, $usageStatsRetentionHourly) { - $queueForDeletes - ->setType(DELETE_TYPE_MAINTENANCE) - ->setProject($project) - ->setUsageRetentionHourlyDateTime(DateTime::addSeconds(new \DateTime(), -1 * $usageStatsRetentionHourly)) - ->trigger(); - }, [ - Query::limit(100), - ]); + $queueForDeletes + ->setType(DELETE_TYPE_MAINTENANCE) + ->setProject($project) + ->setUsageRetentionHourlyDateTime(DateTime::addSeconds(new \DateTime(), -1 * $usageStatsRetentionHourly)) + ->trigger(); + }, + [ + Query::limit(100), + ] + ); $queueForDeletes ->setType(DELETE_TYPE_MAINTENANCE) diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index af346aa2e9..5be865f42b 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -493,17 +493,17 @@ class Deletes extends Action ); } - /** - * @param Database $dbForPlatform - * @param Document $document - * @return void - * @throws Authorization - * @throws DatabaseException - * @throws Conflict - * @throws Restricted - * @throws Structure - * @throws Exception - */ + /** + * @param Database $dbForPlatform + * @param Document $document + * @return void + * @throws Authorization + * @throws DatabaseException + * @throws Conflict + * @throws Restricted + * @throws Structure + * @throws Exception + */ protected function deleteProjectsByTeam(Database $dbForPlatform, callable $getProjectDB, CertificatesAdapter $certificates, Document $document): void {