fix importer

fix plugins on docker
This commit is contained in:
Saeed Vaziry
2025-06-19 16:41:46 +02:00
parent 2081bdd46e
commit f97fffe654
6 changed files with 21 additions and 5 deletions

View File

@ -109,7 +109,9 @@ public function import(Request $request): RedirectResponse
// Replace files
File::move($extractPath.'/database.sqlite', storage_path('database.sqlite'));
File::copy($extractPath.'/.env', base_path('.env'));
if (File::exists($extractPath.'/.env')) {
File::move($extractPath.'/.env', base_path('.env'));
}
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'));

View File

@ -54,7 +54,7 @@ public function install(string $url, ?string $branch = null, ?string $tag = null
$command .= " --tag $tag";
}
$command .= ' --single-branch';
$result = Process::timeout(0)->run($command);
$result = Process::env(['PATH' => dirname(git_path())])->timeout(0)->run($command);
$output = $result->output();
if ($result->failed()) {

View File

@ -265,3 +265,15 @@ function php_path(): ?string
return array_find($paths, fn ($path) => is_executable($path));
}
function git_path(): ?string
{
$paths = [
'/usr/local/bin/git',
'/usr/bin/git',
'/opt/homebrew/bin/git',
trim((string) shell_exec('which git')),
];
return array_find($paths, fn ($path) => is_executable($path));
}