diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-02-19 20:42:48 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-02-19 20:42:48 -0500 |
commit | 3dfb1628ce6e394a80c03a96da7c837209767e5b (patch) | |
tree | a5af4d9a393cbe85d714263901ddc83b00ffb49b /apps | |
parent | 38782036798dbe0a34995a3fca0aa92583cb9099 (diff) | |
download | nextcloud-server-3dfb1628ce6e394a80c03a96da7c837209767e5b.tar.gz nextcloud-server-3dfb1628ce6e394a80c03a96da7c837209767e5b.zip |
Include etags for the root of the shared folder
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/cache.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index 9655e447875..910c268f011 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -28,10 +28,11 @@ namespace OC\Files\Cache; */ class Shared_Cache extends Cache { + private $storage; private $files = array(); public function __construct($storage) { - + $this->storage = $storage; } /** @@ -64,7 +65,14 @@ class Shared_Cache extends Cache { */ public function get($file) { if ($file == '') { - return \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_FILE_APP_ROOT); + $data = \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_FILE_APP_ROOT); + $etag = \OCP\Config::getUserValue(\OCP\User::getUser(), 'files_sharing', 'etag'); + if (!isset($etag)) { + $etag = $this->storage->getETag(''); + \OCP\Config::setUserValue(\OCP\User::getUser(), 'files_sharing', 'etag', $etag); + } + $data['etag'] = $etag; + return $data; } else if (is_string($file)) { if ($cache = $this->getSourceCache($file)) { return $cache->get($this->files[$file]); @@ -117,7 +125,9 @@ class Shared_Cache extends Cache { * @return int file id */ public function put($file, array $data) { - if ($cache = $this->getSourceCache($file)) { + if ($file == '' && isset($data['etag'])) { + \OCP\Config::setUserValue(\OCP\User::getUser(), 'files_sharing', 'etag', $etag); + } else if ($cache = $this->getSourceCache($file)) { return $cache->put($this->files[$file], $data); } return false; |