From bae156db1267667fcd6bfdd3633a1e77371c728a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 12 Jun 2025 22:55:08 +0200 Subject: [PATCH] fix: pass parent id to correctParentStorageMtime when known Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Updater.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index 62d43be5f592f..b3a97aeda7c5d 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -89,7 +89,7 @@ public function update(string $path, ?int $time = null, ?int $sizeDifference = n if ($this->cache instanceof Cache && $sizeDifference === null) { $this->cache->correctFolderSize($path, $data); } - $this->correctParentStorageMtime($path); + $this->correctParentStorageMtime($path, $data['parent'] ?? null); $this->propagator->propagateChange($path, $time, $sizeDifference ?? 0); } @@ -108,10 +108,11 @@ public function remove(string $path): void { $this->cache->remove($path); - $this->correctParentStorageMtime($path); if ($entry instanceof ICacheEntry) { + $this->correctParentStorageMtime($path, $entry->getParentId()); $this->propagator->propagateChange($path, time(), -$entry->getSize()); } else { + $this->correctParentStorageMtime($path); $this->propagator->propagateChange($path, time()); if ($this->cache instanceof Cache) { $this->cache->correctFolderSize($parent); @@ -197,7 +198,7 @@ private function copyOrRenameFromStorage(IStorage $sourceStorage, string $source $this->cache->correctFolderSize($target); } if ($sourceUpdater instanceof Updater) { - $sourceUpdater->correctParentStorageMtime($source); + $sourceUpdater->correctParentStorageMtime($source, $sourceInfo ? $sourceInfo->getParentId() : null); } $this->correctParentStorageMtime($target); $this->updateStorageMTimeOnly($target); @@ -223,8 +224,10 @@ private function updateStorageMTimeOnly(string $internalPath): void { /** * Update the storage_mtime of the direct parent in the cache to the mtime from the storage */ - private function correctParentStorageMtime(string $internalPath): void { - $parentId = $this->cache->getParentId($internalPath); + private function correctParentStorageMtime(string $internalPath, ?int $parentId = null) { + if ($parentId === null) { + $parentId = $this->cache->getParentId($internalPath); + } $parent = dirname($internalPath); if ($parentId !== -1) { $mtime = $this->storage->filemtime($parent);