Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
allow disabling object store write check
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and skjnldsv committed Oct 26, 2022
commit a5036a973c2e5e27354d7112620fdb7a895a44b9
8 changes: 7 additions & 1 deletion lib/private/Files/ObjectStore/ObjectStoreStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -75,6 +78,9 @@ public function __construct($params) {
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('/');
Expand Down Expand Up @@ -522,7 +528,7 @@ public function writeStream(string $path, $stream, int $size = null): int {
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);
Expand Down