summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-03-05 22:23:47 +0100
committerVincent Petry <pvince81@owncloud.com>2015-03-13 11:09:36 +0100
commita529b2bf8699fba0f4ca15a954b59db2efbeafb4 (patch)
treeb05cc03372aaeac827aa6b3b27970411d1ddf941 /apps/files_sharing/lib
parent27ec925132e921f17df27b12e83087ce9196e749 (diff)
downloadnextcloud-server-a529b2bf8699fba0f4ca15a954b59db2efbeafb4.tar.gz
nextcloud-server-a529b2bf8699fba0f4ca15a954b59db2efbeafb4.zip
Fix size propagation over shared storage boundary
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/cache.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index c1ef5030091..57e09c979ac 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -346,6 +346,28 @@ class Shared_Cache extends Cache {
}
/**
+ * update the folder size and the size of all parent folders
+ *
+ * @param string|boolean $path
+ * @param array $data (optional) meta data of the folder
+ */
+ public function correctFolderSize($path, $data = null) {
+ $this->calculateFolderSize($path, $data);
+ if ($path !== '') {
+ $parent = dirname($path);
+ if ($parent === '.' or $parent === '/') {
+ $parent = '';
+ }
+ $this->correctFolderSize($parent);
+ } else {
+ // bubble up to source cache
+ $sourceCache = $this->getSourceCache($path);
+ $parent = dirname($this->files[$path]);
+ $sourceCache->correctFolderSize($parent);
+ }
+ }
+
+ /**
* get the size of a folder and set it in the cache
*
* @param string $path