From: Robin Appelman Date: Thu, 4 Aug 2022 10:32:20 +0000 (+0200) Subject: allow disabling object store write check X-Git-Tag: v26.0.0beta1~514^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a5036a973c2e5e27354d7112620fdb7a895a44b9;p=nextcloud-server.git allow disabling object store write check Signed-off-by: Robin Appelman --- diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index b7044c2d894..04dd846abe4 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -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);