aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-12-06 17:45:07 +0100
committerRobin Appelman <robin@icewind.nl>2024-12-06 17:47:00 +0100
commite7b882dd22474c4c1b22912e629694cb9a80b69b (patch)
treeac984597c191ef9f118f3d739fadaf15249f45e2 /lib
parent7bc21d8a34e9d4a0a066a0069a9a7abf13158368 (diff)
downloadnextcloud-server-e7b882dd22474c4c1b22912e629694cb9a80b69b.tar.gz
nextcloud-server-e7b882dd22474c4c1b22912e629694cb9a80b69b.zip
fix: only do cache copy in updater if the parent folder should be in cachecopy-update-cache-excluded
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Cache/Updater.php10
1 files changed, 9 insertions, 1 deletions
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);
+ }
});
}