diff options
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); + } } |