From 4039f6c9a4bc1636d298d0c05c678f4e1215e846 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 3 Aug 2023 21:56:35 +0200 Subject: Fix cache refresh (#5562) Improvement of https://github.com/FreshRSS/FreshRSS/pull/4422 The main problem was due to `touch()` not automatically clearing the file status cache, and requiring a call to `clearstatcache()`. Example: ``` php > touch('/tmp/touch.txt'); php > echo date('c', filemtime('/tmp/touch.txt')); 2023-08-03T17:27:43+02:00 php > touch('/tmp/touch.txt'); php > echo date('c', filemtime('/tmp/touch.txt')); 2023-08-03T17:27:43+02:00 php > clearstatcache(true, '/tmp/touch.txt'); php > echo date('c', filemtime('/tmp/touch.txt')); 2023-08-03T17:28:21+02:00 ``` --- app/Models/Feed.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/Models/Feed.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 2baee9e0d..80d4e4580 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -859,7 +859,9 @@ class FreshRSS_Feed extends Minz_Model { /** @return int|false */ public function cacheModifiedTime() { - return @filemtime(FreshRSS_Feed::cacheFilename($this->url, $this->attributes(), $this->kind)); + $filename = FreshRSS_Feed::cacheFilename($this->url, $this->attributes(), $this->kind); + clearstatcache(true, $filename); + return @filemtime($filename); } public function lock(): bool { -- cgit v1.2.3