From 01d9ad6b14bc5d9fd6c1140e801e92167b0c7f6a Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Tue, 14 Jun 2016 17:17:43 +0200
Subject: optimized size propagation on deletes

---
 lib/private/Files/Cache/Updater.php | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

(limited to 'lib/private/Files/Cache/Updater.php')

diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php
index 4e17c4d778d..361db4b3f85 100644
--- a/lib/private/Files/Cache/Updater.php
+++ b/lib/private/Files/Cache/Updater.php
@@ -25,6 +25,8 @@
  */
 
 namespace OC\Files\Cache;
+
+use OCP\Files\Cache\ICacheEntry;
 use OCP\Files\Cache\IUpdater;
 use OCP\Files\Storage\IStorage;
 
@@ -150,12 +152,20 @@ class Updater implements IUpdater {
 			$parent = '';
 		}
 
+		$entry = $this->cache->get($path);
+
 		$this->cache->remove($path);
-		if ($this->cache instanceof Cache) {
-			$this->cache->correctFolderSize($parent);
-		}
+
 		$this->correctParentStorageMtime($path);
-		$this->propagator->propagateChange($path, time());
+		if ($entry instanceof ICacheEntry) {
+			$this->propagator->propagateChange($path, time(), -$entry->getSize());
+		} else {
+			$this->propagator->propagateChange($path, time());
+			if ($this->cache instanceof Cache) {
+				$this->cache->correctFolderSize($parent);
+			}
+		}
+
 	}
 
 	/**
-- 
cgit v1.2.3