diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-04-29 15:14:48 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-06-14 10:10:37 +0200 |
commit | 65f3b2fad235417d3f653c9e11aa8d72e8944d28 (patch) | |
tree | fa863ea6c687bd42343e001be6dc975325a91c75 /apps/files_sharing/lib/external/cache.php | |
parent | 4a26219ecf3abe9c1b18d434b8e70a6f9878199c (diff) | |
download | nextcloud-server-65f3b2fad235417d3f653c9e11aa8d72e8944d28.tar.gz nextcloud-server-65f3b2fad235417d3f653c9e11aa8d72e8944d28.zip |
Add server<->server sharing backend
Diffstat (limited to 'apps/files_sharing/lib/external/cache.php')
-rw-r--r-- | apps/files_sharing/lib/external/cache.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/external/cache.php b/apps/files_sharing/lib/external/cache.php new file mode 100644 index 00000000000..cd06bfb1272 --- /dev/null +++ b/apps/files_sharing/lib/external/cache.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OCA\Files_Sharing\External; + +class Cache extends \OC\Files\Cache\Cache { + private $remote; + private $remoteUser; + private $storage; + + /** + * @param \OCA\Files_Sharing\External\Storage $storage + * @param string $remote + * @param string $remoteUser + */ + public function __construct($storage, $remote, $remoteUser) { + $this->storage = $storage; + list(, $remote) = explode('://', $remote, 2); + $this->remote = $remote; + $this->remoteUser = $remoteUser; + parent::__construct($storage); + } + + public function get($file) { + $result = parent::get($file); + $result['displayname_owner'] = $this->remoteUser . '@' . $this->remote; + if (!$file || $file === '') { + $result['is_share_mount_point'] = true; + $mountPoint = rtrim($this->storage->getMountPoint()); + $result['name'] = basename($mountPoint); + } + return $result; + } + + public function getFolderContentsById($id) { + $results = parent::getFolderContentsById($id); + foreach ($results as &$file) { + $file['displayname_owner'] = $this->remoteUser . '@' . $this->remote; + } + return $results; + } +} |