vito/app/SSH/Storage/FTP.php
Saeed Vaziry 428140b931
refactoring (#116)
- refactoring architecture
- fix incomplete ssh logs
- code editor for scripts in the app
- remove Jobs and SSHCommands
2024-03-14 20:03:43 +01:00

49 lines
1.7 KiB
PHP

<?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'
);
}
}