diff options
| author | 2024-07-30 12:01:59 +0200 | |
|---|---|---|
| committer | 2024-07-30 12:01:59 +0200 | |
| commit | 5659b37948c17e5e68971a2464930bee3455dfa1 (patch) | |
| tree | 73cf14f73db93705489f9172f5241dececcc9c49 /app/Models/FeedDAO.php | |
| parent | 5c8369ce38c67fba7dd39d68626534c7e61eb24c (diff) | |
Fix markAsReadUponGone regression (#6663)
Regression from https://github.com/FreshRSS/FreshRSS/pull/5470
Was not working anymore when the feed was empty.
Plus simplification of the logic when the feed is not empty
Diffstat (limited to 'app/Models/FeedDAO.php')
| -rw-r--r-- | app/Models/FeedDAO.php | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 4a75e3dea..204f95939 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -509,20 +509,15 @@ SQL; * Remember to call updateCachedValues() after calling this function * @return int|false number of lines affected or false in case of error */ - public function markAsReadUponGone(int $id) { - //Double SELECT for MySQL workaround ERROR 1093 (HY000) + public function markAsReadNotSeen(int $id, int $minLastSeen) { $sql = <<<'SQL' UPDATE `_entry` SET is_read=1 -WHERE id_feed=:id_feed1 AND is_read=0 AND ( - `lastSeen` + 60 < (SELECT s1.maxlastseen FROM ( - SELECT MAX(e2.`lastSeen`) AS maxlastseen FROM `_entry` e2 WHERE e2.id_feed = :id_feed2 - ) s1) -) +WHERE id_feed=:id_feed AND is_read=0 AND (`lastSeen` + 10 < :min_last_seen) SQL; if (($stm = $this->pdo->prepare($sql)) && - $stm->bindParam(':id_feed1', $id, PDO::PARAM_INT) && - $stm->bindParam(':id_feed2', $id, PDO::PARAM_INT) && + $stm->bindValue(':id_feed', $id, PDO::PARAM_INT) && + $stm->bindValue(':min_last_seen', $minLastSeen, PDO::PARAM_INT) && $stm->execute()) { return $stm->rowCount(); } else { |
