From 01cbfb3c5e0fa1f06852f24573d3edbd2c9008ed Mon Sep 17 00:00:00 2001 From: Knah Tsaeb Date: Fri, 23 Aug 2024 16:53:13 +0200 Subject: [PATCH] Fix bad cache detection --- app/Cache.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Cache.php b/app/Cache.php index 2d1824c..c6abac5 100644 --- a/app/Cache.php +++ b/app/Cache.php @@ -97,11 +97,13 @@ class Cache { * @return bool `true` if the count of files and directories has changed and the cache is updated; `false` otherwise. */ public function changeFile(): bool { - if (isset($this->fileCache[$this->currentDir])) { - if ($this->counter[$this->currentDir] !== $this->fileCache[$this->currentDir]) { - $this->fileCache = array_merge($this->fileCache, $this->counter); - return true; - } + if (!isset($this->fileCache[$this->currentDir])) { + $this->fileCache[$this->currentDir] = -1; + } + + if ($this->counter[$this->currentDir] !== $this->fileCache[$this->currentDir]) { + $this->fileCache = array_merge($this->fileCache, $this->counter); + return true; } return false; }