mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-14 08:37:00 +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
|
@ -1,5 +1,15 @@
|
||||||
{
|
{
|
||||||
"storageType": "sftp",
|
"storageType": "sftp",
|
||||||
|
"ftp": {
|
||||||
|
"host": "your_sftp_host",
|
||||||
|
"username": "your_username",
|
||||||
|
"password": "your_password",
|
||||||
|
"port": 21,
|
||||||
|
"basePath": "/",
|
||||||
|
"passive": true,
|
||||||
|
"ssl": false,
|
||||||
|
"timeout": 30
|
||||||
|
},
|
||||||
"sftp": {
|
"sftp": {
|
||||||
"host": "your_sftp_host",
|
"host": "your_sftp_host",
|
||||||
"username": "your_username",
|
"username": "your_username",
|
||||||
|
|
|
@ -4,6 +4,8 @@ require __DIR__ . '/vendor/autoload.php';
|
||||||
require_once 'helpers.php';
|
require_once 'helpers.php';
|
||||||
|
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
|
use League\Flysystem\Ftp\FtpAdapter;
|
||||||
|
use League\Flysystem\Ftp\FtpConnectionOptions;
|
||||||
use League\Flysystem\PhpseclibV3\SftpConnectionProvider;
|
use League\Flysystem\PhpseclibV3\SftpConnectionProvider;
|
||||||
use League\Flysystem\PhpseclibV3\SftpAdapter;
|
use League\Flysystem\PhpseclibV3\SftpAdapter;
|
||||||
use League\Flysystem\UnixVisibility\PortableVisibilityConverter;
|
use League\Flysystem\UnixVisibility\PortableVisibilityConverter;
|
||||||
|
@ -63,6 +65,22 @@ switch ($storageType) {
|
||||||
|
|
||||||
$adapter = new SftpAdapter($sftpProvider, $sftpSettings['basePath'], $visibilityConverter);
|
$adapter = new SftpAdapter($sftpProvider, $sftpSettings['basePath'], $visibilityConverter);
|
||||||
break;
|
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':
|
case 'dropbox':
|
||||||
$dropboxSettings = $config['dropbox'];
|
$dropboxSettings = $config['dropbox'];
|
||||||
$client = new \Spatie\Dropbox\Client($dropboxSettings['accessToken']);
|
$client = new \Spatie\Dropbox\Client($dropboxSettings['accessToken']);
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"badcow/dns": "^4.2",
|
"badcow/dns": "^4.3",
|
||||||
"phpseclib/phpseclib": "^3.0",
|
"phpseclib/phpseclib": "^3.0.43",
|
||||||
"phpbu/phpbu": "^6.0",
|
"phpbu/phpbu": "^6.0.29",
|
||||||
"setbased/php-audit": "^1.9",
|
"setbased/php-audit": "^1.10.0",
|
||||||
"monolog/monolog": "^3.7",
|
"monolog/monolog": "^3.8.1",
|
||||||
"league/flysystem": "^3.28",
|
"league/flysystem": "^3.28",
|
||||||
"league/flysystem-sftp-v3": "^3.28",
|
"league/flysystem-sftp-v3": "^3.28",
|
||||||
"peppeocchi/php-cron-scheduler": "^4.0",
|
"peppeocchi/php-cron-scheduler": "^4.0",
|
||||||
"predis/predis": "^2.2",
|
"predis/predis": "^2.2",
|
||||||
"guzzlehttp/guzzle": "^7.9"
|
"guzzlehttp/guzzle": "^7.9",
|
||||||
|
"league/flysystem-ftp": "^3.29"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue