]> source.dussan.org Git - nextcloud-server.git/commitdiff
more reliable return value for Watcher::checkUpdate
authorRobin Appelman <robin@icewind.nl>
Fri, 15 Oct 2021 14:03:18 +0000 (16:03 +0200)
committerRobin Appelman <robin@icewind.nl>
Tue, 26 Oct 2021 12:45:08 +0000 (14:45 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Cache/Watcher.php

index 19e17e6095986be84c2673209c422dc837f440c7..15e15f9f458abff957d5a12b61a413734b30cc03 100644 (file)
@@ -89,7 +89,14 @@ class Watcher implements IWatcher {
                }
                if ($cachedEntry === false || $this->needsUpdate($path, $cachedEntry)) {
                        $this->update($path, $cachedEntry);
-                       return true;
+
+                       if ($cachedEntry === false) {
+                               return true;
+                       } else {
+                               // storage backends can sometimes return false positives, only return true if the scanner actually found a change
+                               $newEntry = $this->cache->get($path);
+                               return $newEntry->getStorageMTime() > $cachedEntry->getStorageMTime();
+                       }
                } else {
                        return false;
                }