summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-03-05 22:23:47 +0100
committerVincent Petry <pvince81@owncloud.com>2015-03-05 22:23:47 +0100
commit4322287fc3561b6c34f289c41519e1fa0f034565 (patch)
treef448dc7a649c27b4653265c98fd7c6614807b645 /apps
parent9f5433c0c3050c61e3e1cc2b7a71352dfe7f9250 (diff)
downloadnextcloud-server-4322287fc3561b6c34f289c41519e1fa0f034565.tar.gz
nextcloud-server-4322287fc3561b6c34f289c41519e1fa0f034565.zip
Fix size propagation over shared storage boundary
Diffstat (limited to 'apps')
-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 e0737834812..b71dfb44ab0 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -395,6 +395,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