From 4c5f3bbd9b81e73316c794bd47debf1659e7723c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 9 May 2023 22:31:43 +0200 Subject: Fix markAsReadUponGone (#5382) Fix regression from https://github.com/FreshRSS/FreshRSS/pull/5315 which indroduced a bug for cached feeds. We now update the `lastSeen` property of entries to account for the fact that they are unchanged but still existing. --- app/Controllers/feedController.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/Controllers/feedController.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 645175d19..fc03f7224 100644 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -400,6 +400,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { } $isNewFeed = $feed->lastUpdate() <= 0; + $feedIsUnchanged = false; try { if ($simplePiePush) { @@ -416,6 +417,10 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { } } else { $simplePie = $feed->load(false, $isNewFeed); + if ($simplePie === null) { + // Feed is cached and unchanged + $feedIsUnchanged = true; + } } $newGuids = $simplePie === null ? [] : $feed->loadGuids($simplePie); $entries = $simplePie === null ? [] : $feed->loadEntries($simplePie); @@ -525,6 +530,12 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { } } $entryDAO->updateLastSeen($feed->id(), array_keys($newGuids), $mtime); + } elseif ($feedIsUnchanged) { + // Feed cache was unchanged, so mark as seen the same entries as last time + if (!$entryDAO->inTransaction()) { + $entryDAO->beginTransaction(); + } + $entryDAO->updateLastSeenUnchanged($feed->id(), $mtime); } unset($entries); -- cgit v1.2.3