mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-13 16:16:59 +02:00
Added ability to upload backups via FTP
This commit is contained in:
parent
e3f5d9f94e
commit
8e943ce1c8
3 changed files with 35 additions and 6 deletions
|
@ -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']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue