diff --git a/automation/backup-upload.json.dist b/automation/backup-upload.json.dist index 52ebb56..2d5b6c9 100644 --- a/automation/backup-upload.json.dist +++ b/automation/backup-upload.json.dist @@ -1,5 +1,15 @@ { "storageType": "sftp", + "ftp": { + "host": "your_sftp_host", + "username": "your_username", + "password": "your_password", + "port": 21, + "basePath": "/", + "passive": true, + "ssl": false, + "timeout": 30 + }, "sftp": { "host": "your_sftp_host", "username": "your_username", diff --git a/automation/backup-upload.php b/automation/backup-upload.php index 83e3424..d55dbe6 100644 --- a/automation/backup-upload.php +++ b/automation/backup-upload.php @@ -4,6 +4,8 @@ require __DIR__ . '/vendor/autoload.php'; require_once 'helpers.php'; use League\Flysystem\Filesystem; +use League\Flysystem\Ftp\FtpAdapter; +use League\Flysystem\Ftp\FtpConnectionOptions; use League\Flysystem\PhpseclibV3\SftpConnectionProvider; use League\Flysystem\PhpseclibV3\SftpAdapter; use League\Flysystem\UnixVisibility\PortableVisibilityConverter; @@ -63,6 +65,22 @@ switch ($storageType) { $adapter = new SftpAdapter($sftpProvider, $sftpSettings['basePath'], $visibilityConverter); break; + case 'ftp': + $ftpSettings = $config['ftp']; + + $connectionOptions = FtpConnectionOptions::fromArray([ + 'host' => $ftpSettings['host'], + 'username' => $ftpSettings['username'], + 'password' => $ftpSettings['password'], + 'port' => $ftpSettings['port'] ?? 21, + 'root' => $ftpSettings['basePath'] ?? '/', + 'passive' => $ftpSettings['passive'] ?? true, + 'ssl' => $ftpSettings['ssl'] ?? false, + 'timeout' => $ftpSettings['timeout'] ?? 30, + ]); + + $adapter = new FtpAdapter($connectionOptions); + break; case 'dropbox': $dropboxSettings = $config['dropbox']; $client = new \Spatie\Dropbox\Client($dropboxSettings['accessToken']); diff --git a/automation/composer.json b/automation/composer.json index 2cfcf30..06fb630 100644 --- a/automation/composer.json +++ b/automation/composer.json @@ -1,14 +1,15 @@ { "require": { - "badcow/dns": "^4.2", - "phpseclib/phpseclib": "^3.0", - "phpbu/phpbu": "^6.0", - "setbased/php-audit": "^1.9", - "monolog/monolog": "^3.7", + "badcow/dns": "^4.3", + "phpseclib/phpseclib": "^3.0.43", + "phpbu/phpbu": "^6.0.29", + "setbased/php-audit": "^1.10.0", + "monolog/monolog": "^3.8.1", "league/flysystem": "^3.28", "league/flysystem-sftp-v3": "^3.28", "peppeocchi/php-cron-scheduler": "^4.0", "predis/predis": "^2.2", - "guzzlehttp/guzzle": "^7.9" + "guzzlehttp/guzzle": "^7.9", + "league/flysystem-ftp": "^3.29" } }