]> source.dussan.org Git - nextcloud-server.git/commitdiff
allow disabling object store write check
authorRobin Appelman <robin@icewind.nl>
Thu, 4 Aug 2022 10:32:20 +0000 (12:32 +0200)
committerJohn Molakvoæ (Rebase PR Action) <skjnldsv@users.noreply.github.com>
Wed, 26 Oct 2022 18:45:59 +0000 (18:45 +0000)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/ObjectStore/ObjectStoreStorage.php

index b7044c2d8949c007a51680e65e886eb161c7a822..04dd846abe40f3dc5122f65f2cb559e9cbf0fbd9 100644 (file)
@@ -61,6 +61,9 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
 
        private $logger;
 
+       /** @var bool */
+       protected $validateWrites = true;
+
        public function __construct($params) {
                if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
                        $this->objectStore = $params['objectstore'];
@@ -75,6 +78,9 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
                if (isset($params['objectPrefix'])) {
                        $this->objectPrefix = $params['objectPrefix'];
                }
+               if (isset($params['validateWrites'])) {
+                       $this->validateWrites = (bool)$params['validateWrites'];
+               }
                //initialize cache with root directory in cache
                if (!$this->is_dir('/')) {
                        $this->mkdir('/');
@@ -522,7 +528,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
                if ($exists) {
                        $this->getCache()->update($fileId, $stat);
                } else {
-                       if ($this->objectStore->objectExists($urn)) {
+                       if (!$this->validateWrites || $this->objectStore->objectExists($urn)) {
                                $this->getCache()->move($uploadPath, $path);
                        } else {
                                $this->getCache()->remove($uploadPath);