Merge pull request #2114 from nextcloud/downstream-26498
make object prefix configurable
This commit is contained in:
commit
b7e13b43fb
|
@ -1005,9 +1005,9 @@ $CONFIG = array(
|
||||||
*
|
*
|
||||||
* One way to test is applying for a trystack account at http://trystack.org/
|
* One way to test is applying for a trystack account at http://trystack.org/
|
||||||
*/
|
*/
|
||||||
'objectstore' => array(
|
'objectstore' => [
|
||||||
'class' => 'OC\\Files\\ObjectStore\\Swift',
|
'class' => 'OC\\Files\\ObjectStore\\Swift',
|
||||||
'arguments' => array(
|
'arguments' => [
|
||||||
// trystack will user your facebook id as the user name
|
// trystack will user your facebook id as the user name
|
||||||
'username' => 'facebook100000123456789',
|
'username' => 'facebook100000123456789',
|
||||||
// in the trystack dashboard go to user -> settings -> API Password to
|
// in the trystack dashboard go to user -> settings -> API Password to
|
||||||
|
@ -1015,6 +1015,8 @@ $CONFIG = array(
|
||||||
'password' => 'Secr3tPaSSWoRdt7',
|
'password' => 'Secr3tPaSSWoRdt7',
|
||||||
// must already exist in the objectstore, name can be different
|
// must already exist in the objectstore, name can be different
|
||||||
'container' => 'nextcloud',
|
'container' => 'nextcloud',
|
||||||
|
// prefix to prepend to the fileid, default is 'oid:urn:'
|
||||||
|
'objectPrefix' => 'oid:urn:',
|
||||||
// create the container if it does not exist. default is false
|
// create the container if it does not exist. default is false
|
||||||
'autocreate' => true,
|
'autocreate' => true,
|
||||||
// required, dev-/trystack defaults to 'RegionOne'
|
// required, dev-/trystack defaults to 'RegionOne'
|
||||||
|
@ -1028,8 +1030,8 @@ $CONFIG = array(
|
||||||
'serviceName' => 'swift',
|
'serviceName' => 'swift',
|
||||||
// The Interface / url Type, optional
|
// The Interface / url Type, optional
|
||||||
'urlType' => 'internal'
|
'urlType' => 'internal'
|
||||||
),
|
],
|
||||||
),
|
],
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,6 +48,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
private $objectPrefix = 'urn:oid:';
|
||||||
|
|
||||||
public function __construct($params) {
|
public function __construct($params) {
|
||||||
if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
|
if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
|
||||||
$this->objectStore = $params['objectstore'];
|
$this->objectStore = $params['objectstore'];
|
||||||
|
@ -59,6 +61,9 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
|
||||||
} else {
|
} else {
|
||||||
$this->id = 'object::store:' . $this->objectStore->getStorageId();
|
$this->id = 'object::store:' . $this->objectStore->getStorageId();
|
||||||
}
|
}
|
||||||
|
if (isset($params['objectPrefix'])) {
|
||||||
|
$this->objectPrefix = $params['objectPrefix'];
|
||||||
|
}
|
||||||
//initialize cache with root directory in cache
|
//initialize cache with root directory in cache
|
||||||
if (!$this->is_dir('/')) {
|
if (!$this->is_dir('/')) {
|
||||||
$this->mkdir('/');
|
$this->mkdir('/');
|
||||||
|
@ -216,7 +221,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
|
||||||
*/
|
*/
|
||||||
protected function getURN($fileId) {
|
protected function getURN($fileId) {
|
||||||
if (is_numeric($fileId)) {
|
if (is_numeric($fileId)) {
|
||||||
return 'urn:oid:' . $fileId;
|
return $this->objectPrefix . $fileId;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ cat > $thisFolder/swift.config.php <<DELIM
|
||||||
'username' => '$user',
|
'username' => '$user',
|
||||||
'password' => '$pass',
|
'password' => '$pass',
|
||||||
'container' => 'owncloud-autotest$EXECUTOR_NUMBER',
|
'container' => 'owncloud-autotest$EXECUTOR_NUMBER',
|
||||||
|
'objectPrefix' => 'autotest$EXECUTOR_NUMBER:oid:urn:',
|
||||||
'autocreate' => true,
|
'autocreate' => true,
|
||||||
'region' => '$region',
|
'region' => '$region',
|
||||||
'url' => 'http://$host:$port/v2.0',
|
'url' => 'http://$host:$port/v2.0',
|
||||||
|
|
Loading…
Reference in New Issue