Skip to content

Commit b80e2d6

Browse files
committed
fix: pass parent id to correctParentStorageMtime when known
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 3592f83 commit b80e2d6

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

lib/private/Files/Cache/Updater.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function update(string $path, ?int $time = null, ?int $sizeDifference = n
8989
if ($this->cache instanceof Cache && $sizeDifference === null) {
9090
$this->cache->correctFolderSize($path, $data);
9191
}
92-
$this->correctParentStorageMtime($path);
92+
$this->correctParentStorageMtime($path, $data['parent'] ?? null);
9393
$this->propagator->propagateChange($path, $time, $sizeDifference ?? 0);
9494
}
9595

@@ -108,10 +108,11 @@ public function remove(string $path): void {
108108

109109
$this->cache->remove($path);
110110

111-
$this->correctParentStorageMtime($path);
112111
if ($entry instanceof ICacheEntry) {
112+
$this->correctParentStorageMtime($path, $entry->getParentId());
113113
$this->propagator->propagateChange($path, time(), -$entry->getSize());
114114
} else {
115+
$this->correctParentStorageMtime($path);
115116
$this->propagator->propagateChange($path, time());
116117
if ($this->cache instanceof Cache) {
117118
$this->cache->correctFolderSize($parent);
@@ -197,7 +198,7 @@ private function copyOrRenameFromStorage(IStorage $sourceStorage, string $source
197198
$this->cache->correctFolderSize($target);
198199
}
199200
if ($sourceUpdater instanceof Updater) {
200-
$sourceUpdater->correctParentStorageMtime($source);
201+
$sourceUpdater->correctParentStorageMtime($source, $sourceInfo ? $sourceInfo->getParentId() : null);
201202
}
202203
$this->correctParentStorageMtime($target);
203204
$this->updateStorageMTimeOnly($target);
@@ -223,8 +224,10 @@ private function updateStorageMTimeOnly(string $internalPath): void {
223224
/**
224225
* Update the storage_mtime of the direct parent in the cache to the mtime from the storage
225226
*/
226-
private function correctParentStorageMtime(string $internalPath): void {
227-
$parentId = $this->cache->getParentId($internalPath);
227+
private function correctParentStorageMtime(string $internalPath, ?int $parentId = null) {
228+
if ($parentId === null): void {
229+
$parentId = $this->cache->getParentId($internalPath);
230+
}
228231
$parent = dirname($internalPath);
229232
if ($parentId !== -1) {
230233
$mtime = $this->storage->filemtime($parent);

0 commit comments

Comments
 (0)