Skip to content

Commit 4872533

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

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

lib/private/Files/Cache/Updater.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function update($path, $time = null, ?int $sizeDifference = null) {
124124
if ($this->cache instanceof Cache && $sizeDifference === null) {
125125
$this->cache->correctFolderSize($path, $data);
126126
}
127-
$this->correctParentStorageMtime($path);
127+
$this->correctParentStorageMtime($path, $data['parent'] ?? -1);
128128
$this->propagator->propagateChange($path, $time, $sizeDifference ?? 0);
129129
}
130130

@@ -147,7 +147,7 @@ public function remove($path) {
147147

148148
$this->cache->remove($path);
149149

150-
$this->correctParentStorageMtime($path);
150+
$this->correctParentStorageMtime($path, $entry->getParentId());
151151
if ($entry instanceof ICacheEntry) {
152152
$this->propagator->propagateChange($path, time(), -$entry->getSize());
153153
} else {
@@ -244,7 +244,7 @@ private function copyOrRenameFromStorage(IStorage $sourceStorage, string $source
244244
$this->cache->correctFolderSize($target);
245245
}
246246
if ($sourceUpdater instanceof Updater) {
247-
$sourceUpdater->correctParentStorageMtime($source);
247+
$sourceUpdater->correctParentStorageMtime($source, $sourceInfo->getParentId());
248248
}
249249
$this->correctParentStorageMtime($target);
250250
$this->updateStorageMTimeOnly($target);
@@ -269,11 +269,11 @@ private function updateStorageMTimeOnly($internalPath) {
269269

270270
/**
271271
* update the storage_mtime of the direct parent in the cache to the mtime from the storage
272-
*
273-
* @param string $internalPath
274272
*/
275-
private function correctParentStorageMtime($internalPath) {
276-
$parentId = $this->cache->getParentId($internalPath);
273+
private function correctParentStorageMtime(string $internalPath, int $parentId = -1) {
274+
if ($parentId === null) {
275+
$parentId = $this->cache->getParentId($internalPath);
276+
}
277277
$parent = dirname($internalPath);
278278
if ($parentId != -1) {
279279
$mtime = $this->storage->filemtime($parent);

0 commit comments

Comments
 (0)