From 4322287fc3561b6c34f289c41519e1fa0f034565 Mon Sep 17 00:00:00 2001
From: Vincent Petry <pvince81@owncloud.com>
Date: Thu, 5 Mar 2015 22:23:47 +0100
Subject: [PATCH] Fix size propagation over shared storage boundary

---
 apps/files_sharing/lib/cache.php | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index e073783481..b71dfb44ab 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -394,6 +394,28 @@ class Shared_Cache extends Cache {
 		return $result;
 	}
 
+	/**
+	 * 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
 	 *
-- 
GitLab