summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-05-02 16:03:31 +0200
committerGitHub <noreply@github.com>2018-05-02 16:03:31 +0200
commita56ec1062af36c02666277f7f97f6a407a87d1e1 (patch)
tree838df54551f4edd92f82ead880cd40c4775a297f
parentdfe6d65410ba2f8ae671a7f75764639533c8c068 (diff)
parent055a003661a5c53e092103f02c57015f256ece94 (diff)
downloadnextcloud-server-a56ec1062af36c02666277f7f97f6a407a87d1e1.tar.gz
nextcloud-server-a56ec1062af36c02666277f7f97f6a407a87d1e1.zip
Merge pull request #9346 from nextcloud/techdep/noid/needsPartFile_to_storage
Use an actual function of the storage to determine needsPartFile
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php22
-rw-r--r--apps/files_external/lib/Lib/Storage/OwnCloud.php4
-rw-r--r--apps/files_sharing/lib/External/Storage.php3
3 files changed, 12 insertions, 17 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index 45b31c2e11d..bbd6717d94f 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -51,6 +51,7 @@ use OCP\Files\InvalidContentException;
use OCP\Files\InvalidPathException;
use OCP\Files\LockNotAcquiredException;
use OCP\Files\NotPermittedException;
+use OCP\Files\Storage;
use OCP\Files\StorageNotAvailableException;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
@@ -135,8 +136,9 @@ class File extends Node implements IFile {
}
}
+ /** @var Storage $partStorage */
list($partStorage) = $this->fileView->resolvePath($this->path);
- $needsPartFile = $this->needsPartFile($partStorage) && (strlen($this->path) > 1);
+ $needsPartFile = $partStorage->needsPartFile() && (strlen($this->path) > 1);
if ($needsPartFile) {
// mark file as partial while uploading (ignored by the scanner)
@@ -443,8 +445,9 @@ class File extends Node implements IFile {
}
if ($chunk_handler->isComplete()) {
+ /** @var Storage $storage */
list($storage,) = $this->fileView->resolvePath($path);
- $needsPartFile = $this->needsPartFile($storage);
+ $needsPartFile = $storage->needsPartFile();
$partFile = null;
$targetPath = $path . '/' . $info['name'];
@@ -530,21 +533,6 @@ class File extends Node implements IFile {
}
/**
- * Returns whether a part file is needed for the given storage
- * or whether the file can be assembled/uploaded directly on the
- * target storage.
- *
- * @param \OCP\Files\Storage $storage
- * @return bool true if the storage needs part file handling
- */
- private function needsPartFile($storage) {
- // TODO: in the future use ChunkHandler provided by storage
- return !$storage->instanceOfStorage('OCA\Files_Sharing\External\Storage') &&
- !$storage->instanceOfStorage('OC\Files\Storage\OwnCloud') &&
- $storage->needsPartFile();
- }
-
- /**
* Convert the given exception to a SabreException instance
*
* @param \Exception $e
diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php
index d56e6b66145..3ee2b70ef22 100644
--- a/apps/files_external/lib/Lib/Storage/OwnCloud.php
+++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php
@@ -73,4 +73,8 @@ class OwnCloud extends \OC\Files\Storage\DAV{
parent::__construct($params);
}
+
+ public function needsPartFile() {
+ return false;
+ }
}
diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php
index 638f82f7027..a631a029aba 100644
--- a/apps/files_sharing/lib/External/Storage.php
+++ b/apps/files_sharing/lib/External/Storage.php
@@ -366,4 +366,7 @@ class Storage extends DAV implements ISharedStorage {
return $permissions;
}
+ public function needsPartFile() {
+ return false;
+ }
}