aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-12-12 15:24:40 +0100
committerRobin Appelman <robin@icewind.nl>2018-12-12 15:24:40 +0100
commitd6bf5d43841f8d80ed54137db75c8ca6d2396cf4 (patch)
treeebd0520e813236fa005ec9fe49e1b04c3544a03d /tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php
parent6c9f2644cf8bac151b9af743802eb72a51278e8b (diff)
downloadnextcloud-server-d6bf5d43841f8d80ed54137db75c8ca6d2396cf4.tar.gz
nextcloud-server-d6bf5d43841f8d80ed54137db75c8ca6d2396cf4.zip
upload new files in objectstore to a .part path first
This prevent the object store and cache from getting out of sync when an objectstore silently fails or the php process get's killed during the upload without giving us the chance to cleanup Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php')
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php
new file mode 100644
index 00000000000..5e8faed3347
--- /dev/null
+++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php
@@ -0,0 +1,38 @@
+<?php declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\Files\ObjectStore;
+
+use OC\Files\ObjectStore\ObjectStoreStorage;
+use OCP\Files\ObjectStore\IObjectStore;
+
+/**
+ * Allow overwriting the object store instance for test purposes
+ */
+class ObjectStoreStorageOverwrite extends ObjectStoreStorage {
+ public function setObjectStore(IObjectStore $objectStore) {
+ $this->objectStore = $objectStore;
+ }
+
+ public function getObjectStore(): IObjectStore {
+ return $this->objectStore;
+ }
+}