@@ -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 ' ] ?? null );
128128 $ this ->propagator ->propagateChange ($ path , $ time , $ sizeDifference ?? 0 );
129129 }
130130
@@ -147,10 +147,11 @@ public function remove($path) {
147147
148148 $ this ->cache ->remove ($ path );
149149
150- $ this ->correctParentStorageMtime ($ path );
151150 if ($ entry instanceof ICacheEntry) {
151+ $ this ->correctParentStorageMtime ($ path , $ entry ->getParentId ());
152152 $ this ->propagator ->propagateChange ($ path , time (), -$ entry ->getSize ());
153153 } else {
154+ $ this ->correctParentStorageMtime ($ path );
154155 $ this ->propagator ->propagateChange ($ path , time ());
155156 if ($ this ->cache instanceof Cache) {
156157 $ this ->cache ->correctFolderSize ($ parent );
@@ -244,7 +245,7 @@ private function copyOrRenameFromStorage(IStorage $sourceStorage, string $source
244245 $ this ->cache ->correctFolderSize ($ target );
245246 }
246247 if ($ sourceUpdater instanceof Updater) {
247- $ sourceUpdater ->correctParentStorageMtime ($ source );
248+ $ sourceUpdater ->correctParentStorageMtime ($ source, $ sourceInfo ? $ sourceInfo -> getParentId () : null );
248249 }
249250 $ this ->correctParentStorageMtime ($ target );
250251 $ this ->updateStorageMTimeOnly ($ target );
@@ -269,11 +270,11 @@ private function updateStorageMTimeOnly($internalPath) {
269270
270271 /**
271272 * update the storage_mtime of the direct parent in the cache to the mtime from the storage
272- *
273- * @param string $internalPath
274273 */
275- private function correctParentStorageMtime ($ internalPath ) {
276- $ parentId = $ this ->cache ->getParentId ($ internalPath );
274+ private function correctParentStorageMtime (string $ internalPath , ?int $ parentId = null ) {
275+ if ($ parentId === null ) {
276+ $ parentId = $ this ->cache ->getParentId ($ internalPath );
277+ }
277278 $ parent = dirname ($ internalPath );
278279 if ($ parentId != -1 ) {
279280 $ mtime = $ this ->storage ->filemtime ($ parent );
0 commit comments