From 01d77481baf00102cca021dacdc1425a6245e6ac Mon Sep 17 00:00:00 2001 From: Michal Date: Mon, 26 Feb 2018 18:49:03 +0100 Subject: [PATCH 1/2] add sftp driver --- composer.json | 1 + src/Illuminate/Filesystem/FilesystemManager.php | 14 ++++++++++++++ src/Illuminate/Filesystem/composer.json | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 811ce3c22922..5214f6e73cdf 100644 --- a/composer.json +++ b/composer.json @@ -116,6 +116,7 @@ "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", "league/flysystem-cached-adapter": "Required to use Flysystem caching (~1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (~1.0).", "nexmo/client": "Required to use the Nexmo transport (~1.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", "predis/predis": "Required to use the redis cache and queue drivers (~1.0).", diff --git a/src/Illuminate/Filesystem/FilesystemManager.php b/src/Illuminate/Filesystem/FilesystemManager.php index 04c1bac53a30..b88d6425a345 100644 --- a/src/Illuminate/Filesystem/FilesystemManager.php +++ b/src/Illuminate/Filesystem/FilesystemManager.php @@ -12,6 +12,7 @@ use League\Flysystem\Cached\CachedAdapter; use League\Flysystem\Filesystem as Flysystem; use League\Flysystem\Adapter\Ftp as FtpAdapter; +use League\Flysystem\Sftp\SftpAdapter; use League\Flysystem\Rackspace\RackspaceAdapter; use League\Flysystem\Adapter\Local as LocalAdapter; use League\Flysystem\AwsS3v3\AwsS3Adapter as S3Adapter; @@ -176,6 +177,19 @@ public function createFtpDriver(array $config) )); } + /** + * Create an instance of the sftp driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function createSftpDriver(array $config) + { + return $this->adapt($this->createFlysystem( + new SftpAdapter($config), $config + )); + } + /** * Create an instance of the Amazon S3 driver. * diff --git a/src/Illuminate/Filesystem/composer.json b/src/Illuminate/Filesystem/composer.json index f9e205f4ab73..fa1ad3ea52f0 100644 --- a/src/Illuminate/Filesystem/composer.json +++ b/src/Illuminate/Filesystem/composer.json @@ -32,7 +32,8 @@ "suggest": { "league/flysystem": "Required to use the Flysystem local and FTP drivers (~1.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", - "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0)." + "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (~1.0)." }, "config": { "sort-packages": true From dbca07d69815cf319739cb0b5aa991dac9b8ee6d Mon Sep 17 00:00:00 2001 From: Michal Date: Mon, 26 Feb 2018 19:46:29 +0100 Subject: [PATCH 2/2] style --- src/Illuminate/Filesystem/FilesystemManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Filesystem/FilesystemManager.php b/src/Illuminate/Filesystem/FilesystemManager.php index b88d6425a345..9505a3a3884e 100644 --- a/src/Illuminate/Filesystem/FilesystemManager.php +++ b/src/Illuminate/Filesystem/FilesystemManager.php @@ -8,11 +8,11 @@ use Illuminate\Support\Arr; use InvalidArgumentException; use League\Flysystem\AdapterInterface; +use League\Flysystem\Sftp\SftpAdapter; use League\Flysystem\FilesystemInterface; use League\Flysystem\Cached\CachedAdapter; use League\Flysystem\Filesystem as Flysystem; use League\Flysystem\Adapter\Ftp as FtpAdapter; -use League\Flysystem\Sftp\SftpAdapter; use League\Flysystem\Rackspace\RackspaceAdapter; use League\Flysystem\Adapter\Local as LocalAdapter; use League\Flysystem\AwsS3v3\AwsS3Adapter as S3Adapter;