diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php index 48c5e323514ae..ce8da5c1c4987 100644 --- a/lib/private/Files/Cache/Watcher.php +++ b/lib/private/Files/Cache/Watcher.php @@ -19,6 +19,7 @@ */ class Watcher implements IWatcher { protected int $watchPolicy = self::CHECK_ONCE; + /** @var array $checkedPaths */ protected array $checkedPaths = []; protected ICache $cache; protected IScanner $scanner; @@ -121,8 +122,8 @@ public function needsUpdate($path, $cachedData) { } } - if ($this->watchPolicy === self::CHECK_ALWAYS || ($this->watchPolicy === self::CHECK_ONCE && !in_array($path, $this->checkedPaths))) { - $this->checkedPaths[] = $path; + if ($this->watchPolicy === self::CHECK_ALWAYS || ($this->watchPolicy === self::CHECK_ONCE && !isset($this->checkedPaths[$path]))) { + $this->checkedPaths[$path] = true; return $cachedData['storage_mtime'] === null || $this->storage->hasUpdated($path, $cachedData['storage_mtime']); } return false;