diff --git a/src/Appwrite/Platform/Installer/HttpHandler.php b/src/Appwrite/Platform/Installer/HttpHandler.php index bad75911f5..86ecad2bd1 100644 --- a/src/Appwrite/Platform/Installer/HttpHandler.php +++ b/src/Appwrite/Platform/Installer/HttpHandler.php @@ -222,8 +222,7 @@ class HttpHandler if (function_exists('posix_getpid')) { $pid = posix_getpid(); if ($pid) { - $delay = 5; - $command = 'sh -c ' . escapeshellarg("sleep {$delay}; kill {$pid} >/dev/null 2>&1"); + $command = 'sh -c ' . escapeshellarg("sleep 5; kill $pid >/dev/null 2>&1"); @exec($command . ' >/dev/null 2>&1 &'); } } diff --git a/src/Appwrite/Platform/Installer/Server.php b/src/Appwrite/Platform/Installer/Server.php index 75b605d983..0a29a84ed0 100644 --- a/src/Appwrite/Platform/Installer/Server.php +++ b/src/Appwrite/Platform/Installer/Server.php @@ -228,9 +228,8 @@ class Server private function dockerImageExists(string $image): bool { - $name = escapeshellarg($image); $result = 1; - exec("docker image inspect $name >/dev/null 2>&1", $output, $result); + exec("docker image inspect " . escapeshellarg($image) . " >/dev/null 2>&1", $output, $result); return $result === 0; } @@ -304,8 +303,7 @@ class Server $args[] = '--entrypoint=' . $entrypoint; $args[] = $image; - $escaped = array_map(escapeshellarg(...), $args); - $command = implode(' ', $escaped); + $command = implode(' ', array_map(escapeshellarg(...), $args)); passthru($command, $status); exit($status); } diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index ca612913fb..163869ea6c 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -782,8 +782,7 @@ class Install extends Action $command[] = '-d'; $command[] = '--remove-orphans'; $command[] = '--renew-anon-volumes'; - $escaped = array_map(escapeshellarg(...), $command); - $commandLine = $env . implode(' ', $escaped) . ' 2>&1'; + $commandLine = $env . implode(' ', array_map(escapeshellarg(...), $command)) . ' 2>&1'; \exec($commandLine, $output, $exit); if ($exit !== 0) {