mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 10:21:37 +00:00
51 lines
1.0 KiB
PHP
51 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\SSH\Storage;
|
|
|
|
use App\Exceptions\SSHError;
|
|
|
|
class Local extends AbstractStorage
|
|
{
|
|
/**
|
|
* @throws SSHError
|
|
*/
|
|
public function upload(string $src, string $dest): array
|
|
{
|
|
$destDir = dirname($dest);
|
|
$this->server->ssh()->exec(
|
|
view('ssh.storage.local.upload', [
|
|
'src' => $src,
|
|
'destDir' => $destDir,
|
|
'destFile' => $dest,
|
|
]),
|
|
'upload-to-local'
|
|
);
|
|
|
|
return [
|
|
'size' => null,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @throws SSHError
|
|
*/
|
|
public function download(string $src, string $dest): void
|
|
{
|
|
$this->server->ssh()->exec(
|
|
view('ssh.storage.local.download', [
|
|
'src' => $src,
|
|
'dest' => $dest,
|
|
]),
|
|
'download-from-local'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @throws SSHError
|
|
*/
|
|
public function delete(string $src): void
|
|
{
|
|
$this->server->os()->deleteFile($src);
|
|
}
|
|
}
|