Browse Source
Fix bucket and container usage
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
pull/8793/head
Roeland Jago Douma
8 years ago
No known key found for this signature in database
GPG Key ID: F941078878347C0C
3 changed files with
8 additions and
4 deletions
-
config/config.sample.php
-
lib/private/Files/ObjectStore/Swift.php
-
lib/private/Files/ObjectStore/SwiftFactory.php
|
|
|
@ -1226,13 +1226,13 @@ $CONFIG = array( |
|
|
|
'password' => 'swift', |
|
|
|
'domain' => [ |
|
|
|
'name' => 'default', |
|
|
|
] |
|
|
|
], |
|
|
|
], |
|
|
|
'tenantName' => 'service', |
|
|
|
'serviceName' => 'swift', |
|
|
|
'region' => 'regionOne', |
|
|
|
'url' => "http://yourswifthost:5000/v3", |
|
|
|
'bucket' => 'nextcloud' |
|
|
|
'bucket' => 'nextcloud', |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
|
|
|
|
@ -62,6 +62,10 @@ class Swift implements IObjectStore { |
|
|
|
* @return string the container name where objects are stored |
|
|
|
*/ |
|
|
|
public function getStorageId() { |
|
|
|
if (isset($this->params['bucket'])) { |
|
|
|
return $this->params['bucket']; |
|
|
|
} |
|
|
|
|
|
|
|
return $this->params['container']; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -77,7 +77,7 @@ class SwiftFactory { |
|
|
|
$this->params['container'] = $this->params['bucket']; |
|
|
|
} |
|
|
|
if (!isset($this->params['container'])) { |
|
|
|
$this->params['container'] = 'owncloud'; |
|
|
|
$this->params['container'] = 'nextcloud'; |
|
|
|
} |
|
|
|
if (!isset($this->params['autocreate'])) { |
|
|
|
// should only be true for tests
|
|
|
|
@ -95,7 +95,7 @@ class SwiftFactory { |
|
|
|
$this->params['tenantName'] = $this->params['tenant']; |
|
|
|
} |
|
|
|
|
|
|
|
$cacheKey = $userName . '@' . $this->params['url'] . '/' . $this->params['bucket']; |
|
|
|
$cacheKey = $userName . '@' . $this->params['url'] . '/' . $this->params['container']; |
|
|
|
$token = $this->getCachedToken($cacheKey); |
|
|
|
$hasToken = is_array($token) && (new \DateTimeImmutable($token['expires_at'])) > (new \DateTimeImmutable('now')); |
|
|
|
if ($hasToken) { |
|
|
|
|