Fix bad cache detection

This commit is contained in:
Knah Tsaeb 2024-08-23 16:53:13 +02:00
parent 698d85080b
commit 01cbfb3c5e

View file

@ -97,12 +97,14 @@ class Cache {
* @return bool `true` if the count of files and directories has changed and the cache is updated; `false` otherwise. * @return bool `true` if the count of files and directories has changed and the cache is updated; `false` otherwise.
*/ */
public function changeFile(): bool { public function changeFile(): bool {
if (isset($this->fileCache[$this->currentDir])) { if (!isset($this->fileCache[$this->currentDir])) {
$this->fileCache[$this->currentDir] = -1;
}
if ($this->counter[$this->currentDir] !== $this->fileCache[$this->currentDir]) { if ($this->counter[$this->currentDir] !== $this->fileCache[$this->currentDir]) {
$this->fileCache = array_merge($this->fileCache, $this->counter); $this->fileCache = array_merge($this->fileCache, $this->counter);
return true; return true;
} }
}
return false; return false;
} }