diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-06-24 14:36:29 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-06-24 14:36:29 +0200 |
commit | 159b603d1380410cb37e2a5ac1604f3ae90286c2 (patch) | |
tree | b61a6f51fa8ed3a26d28a6cb185fd027e2f37ac7 /lib | |
parent | 5756aba5944810ef620e37e5ee6b58b6fb8eaa6e (diff) | |
download | nextcloud-server-159b603d1380410cb37e2a5ac1604f3ae90286c2.tar.gz nextcloud-server-159b603d1380410cb37e2a5ac1604f3ae90286c2.zip |
Add support for rackspace swift backends
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/objectstore/swift.php | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/private/files/objectstore/swift.php b/lib/private/files/objectstore/swift.php index 505b5be35f2..be12d459f8f 100644 --- a/lib/private/files/objectstore/swift.php +++ b/lib/private/files/objectstore/swift.php @@ -23,6 +23,7 @@ namespace OC\Files\ObjectStore; use Guzzle\Http\Exception\ClientErrorResponseException; use OCP\Files\ObjectStore\IObjectStore; use OpenCloud\OpenStack; +use OpenCloud\Rackspace; class Swift implements IObjectStore { @@ -37,9 +38,6 @@ class Swift implements IObjectStore { private $container; public function __construct($params) { - if (!isset($params['username']) || !isset($params['password'])) { - throw new \Exception('Access Key and Secret have to be configured.'); - } if (!isset($params['container'])) { $params['container'] = 'owncloud'; } @@ -48,24 +46,17 @@ class Swift implements IObjectStore { $params['autocreate'] = false; } - $secret = array( - 'username' => $params['username'], - 'password' => $params['password'] - ); - if (isset($params['tenantName'])) { - $secret['tenantName'] = $params['tenantName']; - } - if (isset($params['tenantId'])) { - $secret['tenantId'] = $params['tenantId']; - } - // the OpenCloud client library will default to 'cloudFiles' if $serviceName is null $serviceName = null; if ($params['serviceName']) { $serviceName = $params['serviceName']; } - $client = new OpenStack($params['url'], $secret); + if (isset($params['apiKey'])) { + $client = new Rackspace($params['url'], $params); + } else { + $client = new OpenStack($params['url'], $params); + } $this->objectStoreService = $client->objectStoreService($serviceName, $params['region']); |