Skip to content

Commit

Permalink
Separated sftp and ftp settings, added additional fields to sftp (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
helios-ag authored Oct 10, 2018
1 parent 1dc2e8f commit 6520701
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/Configuration/ElFinderConfigurationReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,20 @@ private function configureFlysystem($opt, $adapter, $serviceName)
'timeout' => $opt['ftp']['timeout'],
'directoryPerm' => $opt['ftp']['directoryPerm'],
);
$filesystem = (!$opt['ftp']['sftp']) ? new Filesystem(new Ftp($settings)) : new Filesystem(new SftpAdapter($settings));
$filesystem = new Filesystem(new Ftp($settings));

break;
case 'sftp':
$settings = array(
'host' => $opt['sftp']['host'],
'port' => $opt['sftp']['port'],
'username' => $opt['sftp']['username'],
'password' => $opt['sftp']['password'],
'privateKey' => $opt['sftp']['privateKey'],
'root' => $opt['sftp']['root'],
'timeout' => $opt['sftp']['timeout'],
);
$filesystem = new Filesystem(new SftpAdapter($settings));

break;
case 'aws_s3_v2':
Expand Down
15 changes: 13 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,29 @@ private function createFlysystemNode()
->arrayNode('ftp')
->canBeEnabled()
->children()
->booleanNode('sftp')->defaultFalse()->end()
->scalarNode('host')->defaultValue('')->end()
->scalarNode('username')->defaultValue('')->end()
->scalarNode('password')->defaultValue('')->end()
->integerNode('port')->defaultValue('')->end()
->integerNode('port')->defaultValue(21)->end()
->booleanNode('passive')->defaultTrue()->end()
->booleanNode('ssl')->defaultTrue()->end()
->integerNode('timeout')->defaultValue(30)->end()
->scalarNode('root')->defaultValue('/')->end()
->integerNode('directoryPerm')->defaultValue(0744)->end()
->end()
->end()
->arrayNode('sftp')
->canBeEnabled()
->children()
->scalarNode('host')->defaultValue('')->end()
->scalarNode('username')->defaultValue('')->end()
->scalarNode('password')->defaultValue('')->end()
->integerNode('port')->defaultValue(21)->end()
->scalarNode('privateKey')->defaultValue('')->end()
->integerNode('timeout')->defaultValue(10)->end()
->scalarNode('root')->defaultValue('/')->end()
->end()
->end()
->arrayNode('aws_s3_v2')
->canBeEnabled()
->children()
Expand Down

0 comments on commit 6520701

Please sign in to comment.