Skip to content

Commit

Permalink
fix: only do cache copy in updater if the parent folder should be in …
Browse files Browse the repository at this point in the history
…cache

Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Dec 6, 2024
1 parent 3719977 commit 3400329
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/private/Files/Cache/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,15 @@ public function renameFromStorage(IStorage $sourceStorage, $source, $target) {
*/
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);
}
});
}

Expand Down

0 comments on commit 3400329

Please sign in to comment.