]> source.dussan.org Git - nextcloud-server.git/commitdiff
make object prefix configurable 2114/head
authorJörn Friedrich Dreyer <jfd@butonic.de>
Thu, 27 Oct 2016 12:15:59 +0000 (14:15 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Mon, 14 Nov 2016 14:10:56 +0000 (15:10 +0100)
config/config.sample.php
lib/private/Files/ObjectStore/ObjectStoreStorage.php
tests/objectstore/start-swift-ceph.sh

index fc52edbc7785d17c7037b32ef71e374f92a5d81e..e95e99e229a762ff771d81a5309613cf6d53bf73 100644 (file)
@@ -1005,9 +1005,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
@@ -1015,6 +1015,8 @@ $CONFIG = array(
                'password' => 'Secr3tPaSSWoRdt7',
                // must already exist in the objectstore, name can be different
                '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
                'autocreate' => true,
                // required, dev-/trystack defaults to 'RegionOne'
@@ -1028,8 +1030,8 @@ $CONFIG = array(
                'serviceName' => 'swift',
                // The Interface / url Type, optional
                'urlType' => 'internal'
-       ),
-),
+       ],
+],
 
 
 /**
index 0f0229c9ca5989432aa91fdf4311271360a58a79..2dcf830cc1e7f06d9bf1163c9b9685059ea3ee06 100644 (file)
@@ -48,6 +48,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'];
@@ -59,6 +61,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('/');
@@ -216,7 +221,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;
        }
index bbf483c28970b16df7e3dd9a48a7f5b9878d7db6..98c0e8b78b2f0e9dc7bf60f46ffdedbe19713c0d 100755 (executable)
@@ -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',