summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-05-13 10:37:04 +0200
committerLukas Reschke <lukas@owncloud.com>2015-05-13 10:37:04 +0200
commit5941e826b8e6005de08fdcb777efb3def5ca8101 (patch)
treee1cd9d4b8b982e7dd156b6220c06c85b2d1ccfa4 /apps/files_sharing
parente753e8cc37d7586bf4ac6ebbe7314835523704af (diff)
parent3b1dde7005057cf9a428f013d568a42438495146 (diff)
downloadnextcloud-server-5941e826b8e6005de08fdcb777efb3def5ca8101.tar.gz
nextcloud-server-5941e826b8e6005de08fdcb777efb3def5ca8101.zip
Merge pull request #16284 from owncloud/shared-storage-view
dont go trough the view when renaming/copying on shared storages
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/sharedstorage.php41
1 files changed, 21 insertions, 20 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index bc01465cb4a..33b7f887e19 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -31,7 +31,6 @@ namespace OC\Files\Storage;
use OC\Files\Cache\ChangePropagator;
use OC\Files\Filesystem;
-use OC\Files\View;
use OCA\Files_Sharing\ISharedStorage;
use OCA\Files_Sharing\Propagator;
use OCA\Files_Sharing\SharedMount;
@@ -327,30 +326,32 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
}
}
- // for part files we need to ask for the owner and path from the parent directory because
- // the file cache doesn't return any results for part files
- if ($isPartFile) {
- list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($pathinfo['dirname']);
- $path1 = $path1 . '/' . $pathinfo['basename'];
- } else {
- list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($relPath1);
- }
- $targetFilename = basename($relPath2);
- list($user2, $path2) = \OCA\Files_Sharing\Helper::getUidAndFilename(dirname($relPath2));
- $rootView = new \OC\Files\View('');
- $rootView->getUpdater()->disable(); // dont update the cache here
- $result = $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename);
- $rootView->getUpdater()->enable();
- return $result;
+
+ /**
+ * @var \OC\Files\Storage\Storage $sourceStorage
+ */
+ list($sourceStorage, $sourceInternalPath) = $this->resolvePath($path1);
+ /**
+ * @var \OC\Files\Storage\Storage $targetStorage
+ */
+ list($targetStorage, $targetInternalPath) = $this->resolvePath($path2);
+
+ return $targetStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
}
public function copy($path1, $path2) {
// Copy the file if CREATE permission is granted
if ($this->isCreatable(dirname($path2))) {
- $oldSource = $this->getSourcePath($path1);
- $newSource = $this->getSourcePath(dirname($path2)) . '/' . basename($path2);
- $rootView = new \OC\Files\View('');
- return $rootView->copy($oldSource, $newSource);
+ /**
+ * @var \OC\Files\Storage\Storage $sourceStorage
+ */
+ list($sourceStorage, $sourceInternalPath) = $this->resolvePath($path1);
+ /**
+ * @var \OC\Files\Storage\Storage $targetStorage
+ */
+ list($targetStorage, $targetInternalPath) = $this->resolvePath($path2);
+
+ return $targetStorage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
}
return false;
}