diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-04-14 14:35:08 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-04-14 14:35:08 +0200 |
commit | 82cab257622759d1b64582f27de33a982c79c158 (patch) | |
tree | bcacfc55a044830e1a5529b9bece572bb6f180e8 /apps/files_sharing/lib/sharedstorage.php | |
parent | ffa115b51725c4774b49c2419f88cb91d726386b (diff) | |
parent | 0f21303b751291188733e24b5f213053ea96a368 (diff) | |
download | nextcloud-server-82cab257622759d1b64582f27de33a982c79c158.tar.gz nextcloud-server-82cab257622759d1b64582f27de33a982c79c158.zip |
Merge pull request #13360 from owncloud/cross-storage-move
Proper copy/move between multiple local storages
Diffstat (limited to 'apps/files_sharing/lib/sharedstorage.php')
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index c2253fcaa3c..8c2f03b1419 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -586,4 +586,38 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { return $result; } + /** + * Resolve the path for the source of the share + * + * @param string $path + * @return array + */ + private function resolvePath($path) { + $source = $this->getSourcePath($path); + return \OC\Files\Filesystem::resolvePath($source); + } + + /** + * @param \OCP\Files\Storage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @return bool + */ + public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + /** @var \OCP\Files\Storage $targetStorage */ + list($targetStorage, $targetInternalPath) = $this->resolvePath($targetInternalPath); + return $targetStorage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); + } + + /** + * @param \OCP\Files\Storage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @return bool + */ + public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + /** @var \OCP\Files\Storage $targetStorage */ + list($targetStorage, $targetInternalPath) = $this->resolvePath($targetInternalPath); + return $targetStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); + } } |