From c41ade97c174af2034980aa277bff39593db58bb Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Tue, 7 May 2019 17:47:58 +0200 Subject: [PATCH 1/2] Remove Rackspace support for Filesystem We're removing this driver because we feel that general interest in it is declining and this isn't used by any of Laravel's core services themselves. We're encouraging the community to release a package for this if there's any interest in continued use of it. --- .../Filesystem/FilesystemAdapter.php | 35 ------------------ .../Filesystem/FilesystemManager.php | 37 ------------------- src/Illuminate/Filesystem/composer.json | 1 - 3 files changed, 73 deletions(-) diff --git a/src/Illuminate/Filesystem/FilesystemAdapter.php b/src/Illuminate/Filesystem/FilesystemAdapter.php index 824905882dd0..53c8760816ec 100644 --- a/src/Illuminate/Filesystem/FilesystemAdapter.php +++ b/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -17,7 +17,6 @@ use League\Flysystem\AwsS3v3\AwsS3Adapter; use League\Flysystem\Cached\CachedAdapter; use League\Flysystem\FileNotFoundException; -use League\Flysystem\Rackspace\RackspaceAdapter; use League\Flysystem\Adapter\Local as LocalAdapter; use Symfony\Component\HttpFoundation\StreamedResponse; use Illuminate\Contracts\Filesystem\Cloud as CloudFilesystemContract; @@ -400,8 +399,6 @@ public function url($path) return $this->driver->getUrl($path); } elseif ($adapter instanceof AwsS3Adapter) { return $this->getAwsUrl($adapter, $path); - } elseif ($adapter instanceof RackspaceAdapter) { - return $this->getRackspaceUrl($adapter, $path); } elseif ($adapter instanceof LocalAdapter) { return $this->getLocalUrl($path); } else { @@ -456,18 +453,6 @@ protected function getAwsUrl($adapter, $path) ); } - /** - * Get the URL for the file at the given path. - * - * @param \League\Flysystem\Rackspace\RackspaceAdapter $adapter - * @param string $path - * @return string - */ - protected function getRackspaceUrl($adapter, $path) - { - return (string) $adapter->getContainer()->getObject($path)->getPublicUrl(); - } - /** * Get the URL for the file at the given path. * @@ -519,8 +504,6 @@ public function temporaryUrl($path, $expiration, array $options = []) return $adapter->getTemporaryUrl($path, $expiration, $options); } elseif ($adapter instanceof AwsS3Adapter) { return $this->getAwsTemporaryUrl($adapter, $path, $expiration, $options); - } elseif ($adapter instanceof RackspaceAdapter) { - return $this->getRackspaceTemporaryUrl($adapter, $path, $expiration, $options); } else { throw new RuntimeException('This driver does not support creating temporary URLs.'); } @@ -549,24 +532,6 @@ public function getAwsTemporaryUrl($adapter, $path, $expiration, $options) )->getUri(); } - /** - * Get a temporary URL for the file at the given path. - * - * @param \League\Flysystem\Rackspace\RackspaceAdapter $adapter - * @param string $path - * @param \DateTimeInterface $expiration - * @param array $options - * @return string - */ - public function getRackspaceTemporaryUrl($adapter, $path, $expiration, $options) - { - return $adapter->getContainer()->getObject($path)->getTemporaryUrl( - Carbon::now()->diffInSeconds($expiration), - $options['method'] ?? 'GET', - $options['forcePublicUrl'] ?? true - ); - } - /** * Concatenate a path to a URL. * diff --git a/src/Illuminate/Filesystem/FilesystemManager.php b/src/Illuminate/Filesystem/FilesystemManager.php index 36f9b89e6351..332de6b55e97 100644 --- a/src/Illuminate/Filesystem/FilesystemManager.php +++ b/src/Illuminate/Filesystem/FilesystemManager.php @@ -4,7 +4,6 @@ use Closure; use Aws\S3\S3Client; -use OpenCloud\Rackspace; use Illuminate\Support\Arr; use InvalidArgumentException; use League\Flysystem\AdapterInterface; @@ -13,7 +12,6 @@ use League\Flysystem\Cached\CachedAdapter; use League\Flysystem\Filesystem as Flysystem; use League\Flysystem\Adapter\Ftp as FtpAdapter; -use League\Flysystem\Rackspace\RackspaceAdapter; use League\Flysystem\Adapter\Local as LocalAdapter; use League\Flysystem\AwsS3v3\AwsS3Adapter as S3Adapter; use League\Flysystem\Cached\Storage\Memory as MemoryStore; @@ -226,41 +224,6 @@ protected function formatS3Config(array $config) return $config; } - /** - * Create an instance of the Rackspace driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Cloud - */ - public function createRackspaceDriver(array $config) - { - $client = new Rackspace($config['endpoint'], [ - 'username' => $config['username'], 'apiKey' => $config['key'], - ], $config['options'] ?? []); - - $root = $config['root'] ?? null; - - return $this->adapt($this->createFlysystem( - new RackspaceAdapter($this->getRackspaceContainer($client, $config), $root), $config - )); - } - - /** - * Get the Rackspace Cloud Files container. - * - * @param \OpenCloud\Rackspace $client - * @param array $config - * @return \OpenCloud\ObjectStore\Resource\Container - */ - protected function getRackspaceContainer(Rackspace $client, array $config) - { - $urlType = $config['url_type'] ?? null; - - $store = $client->objectStoreService('cloudFiles', $config['region'], $urlType); - - return $store->getContainer($config['container']); - } - /** * Create a Flysystem instance with the given adapter. * diff --git a/src/Illuminate/Filesystem/composer.json b/src/Illuminate/Filesystem/composer.json index a6b24e9ff5d0..ed3bd66fb52a 100644 --- a/src/Illuminate/Filesystem/composer.json +++ b/src/Illuminate/Filesystem/composer.json @@ -33,7 +33,6 @@ "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-cached-adapter": "Required to use the Flysystem cache (^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": { From 48f8a90c10b8490d0e442a8f0cf258471208009f Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Tue, 7 May 2019 17:53:21 +0200 Subject: [PATCH 2/2] Remove unused import --- src/Illuminate/Filesystem/FilesystemAdapter.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Illuminate/Filesystem/FilesystemAdapter.php b/src/Illuminate/Filesystem/FilesystemAdapter.php index 53c8760816ec..5eb6b57545ff 100644 --- a/src/Illuminate/Filesystem/FilesystemAdapter.php +++ b/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -7,7 +7,6 @@ use Illuminate\Support\Arr; use Illuminate\Support\Str; use InvalidArgumentException; -use Illuminate\Support\Carbon; use Illuminate\Http\UploadedFile; use Illuminate\Support\Collection; use League\Flysystem\AdapterInterface;