wip: backup existing database

This commit is contained in:
Andras Bacsai
2023-09-05 12:14:31 +02:00
parent f6f4cdde24
commit 1338e68b8c
4 changed files with 73 additions and 35 deletions

View File

@@ -93,7 +93,18 @@ function generate_ssh_command(string $private_key_location, string $server_ip, s
return $ssh_command;
}
function instantCommand(string $command, $throwError = true) {
$process = Process::run($command);
$output = trim($process->output());
$exitCode = $process->exitCode();
if ($exitCode !== 0) {
if (!$throwError) {
return null;
}
throw new \RuntimeException($process->errorOutput(), $exitCode);
}
return $output;
}
function instant_remote_process(array $command, Server $server, $throwError = true, $repeat = 1)
{
$command_string = implode("\n", $command);