Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions lib/private/Files/Cache/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function update($path, $time = null, ?int $sizeDifference = null) {
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);
}

Expand All @@ -147,10 +147,11 @@ public function remove($path) {

$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);
Expand Down Expand Up @@ -244,7 +245,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);
Expand All @@ -269,11 +270,11 @@ private function updateStorageMTimeOnly($internalPath) {

/**
* update the storage_mtime of the direct parent in the cache to the mtime from the storage
*
* @param string $internalPath
*/
private function correctParentStorageMtime($internalPath) {
$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);
Expand Down
Loading