From e7b882dd22474c4c1b22912e629694cb9a80b69b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 6 Dec 2024 17:45:07 +0100 Subject: fix: only do cache copy in updater if the parent folder should be in cache Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Updater.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/private/Files/Cache') diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index aa025a3a96c..1280a2ae267 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -185,7 +185,15 @@ class Updater implements IUpdater { */ public function copyFromStorage(IStorage $sourceStorage, string $source, string $target): void { $this->copyOrRenameFromStorage($sourceStorage, $source, $target, function (ICache $sourceCache, ICacheEntry $sourceInfo) use ($target) { - $this->cache->copyFromCache($sourceCache, $sourceInfo, $target); + $parent = dirname($target); + $parentInCache = $this->cache->inCache($parent); + if (!$parentInCache) { + $parentData = $this->scanner->scan($parent, Scanner::SCAN_SHALLOW, -1, false); + $parentInCache = $parentData !== null; + } + if ($parentInCache) { + $this->cache->copyFromCache($sourceCache, $sourceInfo, $target); + } }); } -- cgit v1.2.3