summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-10-29 16:38:16 +0100
committerVincent Petry <pvince81@owncloud.com>2014-10-29 16:38:16 +0100
commit106b9eb55c154c6ef4fac47fb62f70dbbd98a126 (patch)
treeccdc5e17701226e8f0d15106fdd36c764f9e636d /apps
parent7d10ec41e6817472eb831c3891f7d0a0d514037c (diff)
parent16cfca6a5fb3db897246e6ac9ccb7420cf256240 (diff)
downloadnextcloud-server-106b9eb55c154c6ef4fac47fb62f70dbbd98a126.tar.gz
nextcloud-server-106b9eb55c154c6ef4fac47fb62f70dbbd98a126.zip
Merge pull request #11409 from owncloud/watcher-reuse
Pass the cached data to the filesystem watcher
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/cache.php31
-rw-r--r--apps/files_sharing/lib/watcher.php6
2 files changed, 18 insertions, 19 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index e4fd85fd2a7..270ed704bbd 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -145,26 +145,23 @@ class Shared_Cache extends Cache {
/**
* get the metadata of all files stored in $folder
*
- * @param string $folder
+ * @param string $folderId
* @return array
*/
- public function getFolderContents($folder) {
-
- if ($folder === false) {
- $folder = '';
- }
-
- $dir = ($folder !== '') ? $folder . '/' : '';
-
- $cache = $this->getSourceCache($folder);
+ public function getFolderContentsById($folderId) {
+ $cache = $this->getSourceCache('');
if ($cache) {
- $parent = $this->storage->getFile($folder);
- $sourceFolderContent = $cache->getFolderContents($this->files[$folder]);
- foreach ($sourceFolderContent as $key => $c) {
- $sourceFolderContent[$key]['path'] = $dir . $c['name'];
- $sourceFolderContent[$key]['uid_owner'] = $parent['uid_owner'];
- $sourceFolderContent[$key]['displayname_owner'] = \OC_User::getDisplayName($parent['uid_owner']);
- $sourceFolderContent[$key]['permissions'] = $sourceFolderContent[$key]['permissions'] & $this->storage->getPermissions($dir . $c['name']);
+ $owner = $this->storage->getSharedFrom();
+ $parentPath = $this->getPathById($folderId);
+ if ($parentPath !== '') {
+ $parentPath .= '/';
+ }
+ $sourceFolderContent = $cache->getFolderContentsById($folderId);
+ foreach ($sourceFolderContent as &$c) {
+ $c['path'] = ltrim($parentPath . $c['name'], '/');
+ $c['uid_owner'] = $owner;
+ $c['displayname_owner'] = \OC_User::getDisplayName($owner);
+ $c['permissions'] = $c['permissions'] & $this->storage->getPermissions(false);
}
return $sourceFolderContent;
diff --git a/apps/files_sharing/lib/watcher.php b/apps/files_sharing/lib/watcher.php
index 11d3ce1cabd..5357119ab6c 100644
--- a/apps/files_sharing/lib/watcher.php
+++ b/apps/files_sharing/lib/watcher.php
@@ -30,9 +30,11 @@ class Shared_Watcher extends Watcher {
* check $path for updates
*
* @param string $path
+ * @param array $cachedEntry
+ * @return boolean true if path was updated
*/
- public function checkUpdate($path) {
- if (parent::checkUpdate($path) === true) {
+ public function checkUpdate($path, $cachedEntry = null) {
+ if (parent::checkUpdate($path, $cachedEntry) === true) {
// since checkUpdate() has already updated the size of the subdirs,
// only apply the update to the owner's parent dirs