An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
refactor(remoteProcess): remove redundant file transfer functions for improved clarity
Andras Bacsaib90ff0e09a0f
diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.phpindex 56386a55f5..3218bf878b 100644--- a/bootstrap/helpers/remoteProcess.php+++ b/bootstrap/helpers/remoteProcess.php@@ -84,64 +84,6 @@ function instant_scp(string $source, string $dest, Server $server, $throwError =);}-function transfer_file_to_container(string $content, string $container_path, string $deployment_uuid, Server $server, bool $throwError = true): ?string-{- $temp_file = tempnam(sys_get_temp_dir(), 'coolify_env_');-- try {- // Write content to temporary file- file_put_contents($temp_file, $content);-- // Generate unique filename for server transfer- $server_temp_file = '/tmp/coolify_env_'.uniqid().'_'.$deployment_uuid;-- // Transfer file to server- instant_scp($temp_file, $server_temp_file, $server, $throwError);-- // Ensure parent directory exists in container, then copy file- $parent_dir = dirname($container_path);- $commands = [];- if ($parent_dir !== '.' && $parent_dir !== '/') {- $commands[] = executeInDocker($deployment_uuid, "mkdir -p \"$parent_dir\"");- }- $commands[] = "docker cp $server_temp_file $deployment_uuid:$container_path";- $commands[] = "rm -f $server_temp_file"; // Cleanup server temp file-- return instant_remote_process_with_timeout($commands, $server, $throwError);-- } finally {- // Always cleanup local temp file- if (file_exists($temp_file)) {- unlink($temp_file);- }- }-}--function transfer_file_to_server(string $content, string $server_path, Server $server, bool $throwError = true): ?string-{- $temp_file = tempnam(sys_get_temp_dir(), 'coolify_env_');-- try {- // Write content to temporary file- file_put_contents($temp_file, $content);-- // Ensure parent directory exists on server- $parent_dir = dirname($server_path);- if ($parent_dir !== '.' && $parent_dir !== '/') {- instant_remote_process_with_timeout(["mkdir -p \"$parent_dir\""], $server, $throwError);- }-- // Transfer file directly to server destination- return instant_scp($temp_file, $server_path, $server, $throwError);-- } finally {- // Always cleanup local temp file- if (file_exists($temp_file)) {- unlink($temp_file);- }- }-}-function instant_remote_process_with_timeout(Collection|array $command, Server $server, bool $throwError = true, bool $no_sudo = false): ?string{$command = $command instanceof Collection ? $command->toArray() : $command;