Commit c76605e8 authored by Jörn Friedrich Dreyer's avatar Jörn Friedrich Dreyer
Browse files

make object prefix configurable

parent 5297c403
......@@ -1006,9 +1006,9 @@ $CONFIG = array(
*
* One way to test is applying for a trystack account at http://trystack.org/
*/
'objectstore' => array(
'objectstore' => [
'class' => 'OC\\Files\\ObjectStore\\Swift',
'arguments' => array(
'arguments' => [
// trystack will user your facebook id as the user name
'username' => 'facebook100000123456789',
// in the trystack dashboard go to user -> settings -> API Password to
......@@ -1016,6 +1016,8 @@ $CONFIG = array(
'password' => 'Secr3tPaSSWoRdt7',
// must already exist in the objectstore, name can be different
'container' => 'owncloud',
// prefix to prepend to the fileid, default is 'oid:urn:'
'objectPrefix' => 'oid:urn:',
// create the container if it does not exist. default is false
'autocreate' => true,
// required, dev-/trystack defaults to 'RegionOne'
......@@ -1029,8 +1031,8 @@ $CONFIG = array(
'serviceName' => 'swift',
// The Interface / url Type, optional
'urlType' => 'internal'
),
),
],
],
/**
......
......@@ -47,6 +47,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
*/
protected $user;
private $objectPrefix = 'urn:oid:';
public function __construct($params) {
if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
$this->objectStore = $params['objectstore'];
......@@ -58,6 +60,9 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
} else {
$this->id = 'object::store:' . $this->objectStore->getStorageId();
}
if (isset($params['objectPrefix'])) {
$this->objectPrefix = $params['objectPrefix'];
}
//initialize cache with root directory in cache
if (!$this->is_dir('/')) {
$this->mkdir('/');
......@@ -215,7 +220,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
*/
protected function getURN($fileId) {
if (is_numeric($fileId)) {
return 'urn:oid:' . $fileId;
return $this->objectPrefix . $fileId;
}
return null;
}
......
......@@ -85,6 +85,7 @@ cat > $thisFolder/swift.config.php <<DELIM
'username' => '$user',
'password' => '$pass',
'container' => 'owncloud-autotest$EXECUTOR_NUMBER',
'objectPrefix' => 'autotest$EXECUTOR_NUMBER:oid:urn:',
'autocreate' => true,
'region' => '$region',
'url' => 'http://$host:$port/v2.0',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment