mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-08 17:32:35 +00:00
Built-in File Manager (#458)
This commit is contained in:
@ -263,10 +263,14 @@ public function download(string $url, string $path): string
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
public function unzip(string $path): string
|
||||
public function extract(string $path, ?string $destination = null, ?string $user = null): void
|
||||
{
|
||||
return $this->server->ssh()->exec(
|
||||
'unzip '.$path
|
||||
$this->server->ssh($user)->exec(
|
||||
view('ssh.os.extract', [
|
||||
'path' => $path,
|
||||
'destination' => $destination,
|
||||
]),
|
||||
'extract'
|
||||
);
|
||||
}
|
||||
|
||||
@ -304,9 +308,9 @@ public function resourceInfo(): array
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
public function deleteFile(string $path): void
|
||||
public function deleteFile(string $path, ?string $user = null): void
|
||||
{
|
||||
$this->server->ssh()->exec(
|
||||
$this->server->ssh($user)->exec(
|
||||
view('ssh.os.delete-file', [
|
||||
'path' => $path,
|
||||
]),
|
||||
@ -314,6 +318,33 @@ public function deleteFile(string $path): void
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
public function ls(string $path, ?string $user = null): string
|
||||
{
|
||||
return $this->server->ssh($user)->exec('ls -la '.$path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
public function write(string $path, string $content, ?string $user = null): void
|
||||
{
|
||||
$this->server->ssh($user)->write(
|
||||
$path,
|
||||
$content
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
public function mkdir(string $path, ?string $user = null): string
|
||||
{
|
||||
return $this->server->ssh($user)->exec('mkdir -p '.$path);
|
||||
}
|
||||
|
||||
private function deleteTempFile(string $name): void
|
||||
{
|
||||
if (Storage::disk('local')->exists($name)) {
|
||||
|
@ -199,11 +199,13 @@ public function setupSSL(Ssl $ssl): void
|
||||
*/
|
||||
public function removeSSL(Ssl $ssl): void
|
||||
{
|
||||
$this->service->server->ssh()->exec(
|
||||
'sudo rm -rf '.dirname($ssl->certificate_path).'*',
|
||||
'remove-ssl',
|
||||
$ssl->site_id
|
||||
);
|
||||
if ($ssl->certificate_path) {
|
||||
$this->service->server->ssh()->exec(
|
||||
'sudo rm -rf '.dirname($ssl->certificate_path),
|
||||
'remove-ssl',
|
||||
$ssl->site_id
|
||||
);
|
||||
}
|
||||
|
||||
$this->updateVHost($ssl->site);
|
||||
}
|
||||
|
Reference in New Issue
Block a user