mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 15:32:35 +00:00
fix docker ssh issue by downgrading phpseclib
This commit is contained in:
@ -20,7 +20,8 @@ public function check(Server $server): Server
|
||||
$server->status = ServerStatus::READY;
|
||||
$server->save();
|
||||
}
|
||||
} catch (Throwable) {
|
||||
} catch (Throwable $e) {
|
||||
throw $e;
|
||||
$server->status = ServerStatus::DISCONNECTED;
|
||||
$server->save();
|
||||
Notifier::send($server, new ServerDisconnected($server));
|
||||
|
@ -114,8 +114,12 @@ public function import(Request $request): RedirectResponse
|
||||
}
|
||||
File::move($extractPath.'/ssh-public.key', storage_path('ssh-public.key'));
|
||||
File::move($extractPath.'/ssh-private.pem', storage_path('ssh-private.pem'));
|
||||
File::moveDirectory($extractPath.'/key-pairs', storage_path('app/key-pairs'), true);
|
||||
File::moveDirectory($extractPath.'/server-logs', storage_path('app/server-logs'), true);
|
||||
if (File::exists($extractPath.'/key-pairs')) {
|
||||
move_directory($extractPath.'/key-pairs', storage_path('app/key-pairs'));
|
||||
}
|
||||
if (File::exists($extractPath.'/server-logs')) {
|
||||
move_directory($extractPath.'/server-logs', storage_path('app/server-logs'));
|
||||
}
|
||||
|
||||
return redirect()->route('vito-settings')
|
||||
->with('success', 'Settings imported successfully.');
|
||||
|
@ -277,3 +277,21 @@ function git_path(): ?string
|
||||
|
||||
return array_find($paths, fn ($path) => is_executable($path));
|
||||
}
|
||||
|
||||
function move_directory(string $from, string $to): void
|
||||
{
|
||||
// Remove any stale destination
|
||||
if (File::exists($to)) {
|
||||
File::deleteDirectory($to);
|
||||
}
|
||||
|
||||
// Ensure parent of $to exists
|
||||
File::ensureDirectoryExists(dirname($to));
|
||||
|
||||
// Copy + delete (works across mounts / volumes)
|
||||
if (! File::copyDirectory($from, $to)) {
|
||||
throw new RuntimeException("Could not copy [$from] to [$to]");
|
||||
}
|
||||
|
||||
File::deleteDirectory($from);
|
||||
}
|
||||
|
Reference in New Issue
Block a user