From 313444cb12e1eb4199138fc7e7cbb6f1abb8aed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 13 Feb 2025 11:14:08 +0100 Subject: [PATCH] Fix envCommands set too late --- .../Modules/Functions/Workers/Builds.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 41ab2fe02a..809cb96cc2 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -869,22 +869,27 @@ class Builds extends Action } elseif ($resource->getCollection() === 'sites') { $commands = []; - $commands[] = $deployment->getAttribute('installCommand', ''); - $commands[] = $deployment->getAttribute('buildCommand', ''); - $frameworks = Config::getParam('frameworks', []); $framework = $frameworks[$resource->getAttribute('framework', '')] ?? null; + $envCommand = ''; + $bundleCommand = ''; + if (!is_null($framework)) { $adapter = ($framework['adapters'] ?? [])[$resource->getAttribute('adapter', '')] ?? null; - if (!is_null($adapter) && isset($adapter['bundleCommand'])) { - $commands[] = $adapter['bundleCommand']; - } if (!is_null($adapter) && isset($adapter['envCommand'])) { - $commands[] = $adapter['envCommand']; + $envCommand = $adapter['envCommand']; + } + if (!is_null($adapter) && isset($adapter['bundleCommand'])) { + $bundleCommand = $adapter['bundleCommand']; } } + $commands[] = $envCommand; + $commands[] = $deployment->getAttribute('installCommand', ''); + $commands[] = $deployment->getAttribute('buildCommand', ''); + $commands[] = $bundleCommand; + $commands = array_filter($commands, fn ($command) => !empty($command)); return implode(' && ', $commands);