mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
refactoring (#116)
- refactoring architecture - fix incomplete ssh logs - code editor for scripts in the app - remove Jobs and SSHCommands
This commit is contained in:
48
app/SSH/Storage/FTP.php
Normal file
48
app/SSH/Storage/FTP.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\SSH\Storage;
|
||||
|
||||
use App\SSH\HasScripts;
|
||||
|
||||
class FTP extends AbstractStorage
|
||||
{
|
||||
use HasScripts;
|
||||
|
||||
public function upload(string $src, string $dest): array
|
||||
{
|
||||
$this->server->ssh()->exec(
|
||||
$this->getScript('ftp/upload.sh', [
|
||||
'src' => $src,
|
||||
'dest' => $this->storageProvider->credentials['path'].'/'.$dest,
|
||||
'host' => $this->storageProvider->credentials['host'],
|
||||
'port' => $this->storageProvider->credentials['port'],
|
||||
'username' => $this->storageProvider->credentials['username'],
|
||||
'password' => $this->storageProvider->credentials['password'],
|
||||
'ssl' => $this->storageProvider->credentials['ssl'],
|
||||
'passive' => $this->storageProvider->credentials['passive'],
|
||||
]),
|
||||
'upload-to-ftp'
|
||||
);
|
||||
|
||||
return [
|
||||
'size' => null,
|
||||
];
|
||||
}
|
||||
|
||||
public function download(string $src, string $dest): void
|
||||
{
|
||||
$this->server->ssh()->exec(
|
||||
$this->getScript('ftp/download.sh', [
|
||||
'src' => $this->storageProvider->credentials['path'].'/'.$src,
|
||||
'dest' => $dest,
|
||||
'host' => $this->storageProvider->credentials['host'],
|
||||
'port' => $this->storageProvider->credentials['port'],
|
||||
'username' => $this->storageProvider->credentials['username'],
|
||||
'password' => $this->storageProvider->credentials['password'],
|
||||
'ssl' => $this->storageProvider->credentials['ssl'],
|
||||
'passive' => $this->storageProvider->credentials['passive'],
|
||||
]),
|
||||
'download-from-ftp'
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user