From f0d4f2762d2b74eeadf2fb64ff83039b5cc16c26 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 3 Dec 2023 19:52:02 +0100 Subject: Rework keepmax (#5905) * Rework keepmax fix https://github.com/FreshRSS/FreshRSS/issues/5702 fix https://github.com/FreshRSS/FreshRSS/issues/5870 * More WIP * Minor progress * Progress * Beta * Improved debug message * Revert noCommit * Fix variable reset * Remove debug syslogs --- app/Models/FeedDAO.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/Models/FeedDAO.php') diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 82e33dd84..055ec60e4 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -373,7 +373,7 @@ SQL; * @return array */ public function listFeedsOrderUpdate(int $defaultCacheDuration = 3600, int $limit = 0): array { - $sql = 'SELECT id, url, kind, name, website, `lastUpdate`, `pathEntries`, `httpAuth`, ttl, attributes ' + $sql = 'SELECT id, url, kind, name, website, `lastUpdate`, `pathEntries`, `httpAuth`, ttl, attributes, `cache_nbEntries`, `cache_nbUnreads` ' . 'FROM `_feed` ' . ($defaultCacheDuration < 0 ? '' : 'WHERE ttl >= ' . FreshRSS_Feed::TTL_DEFAULT . ' AND `lastUpdate` < (' . (time() + 60) @@ -468,7 +468,7 @@ SQL; * Remember to call updateCachedValues() after calling this function * @return int|false number of lines affected or false in case of error */ - public function keepMaxUnread(int $id, int $n) { + public function markAsReadMaxUnread(int $id, int $n) { //Double SELECT for MySQL workaround ERROR 1093 (HY000) $sql = <<<'SQL' UPDATE `_entry` SET is_read=1 @@ -610,8 +610,8 @@ SQL; $myFeed->_error($dao['error'] ?? 0); $myFeed->_ttl($dao['ttl'] ?? FreshRSS_Feed::TTL_DEFAULT); $myFeed->_attributes('', $dao['attributes'] ?? ''); - $myFeed->_nbNotRead($dao['cache_nbUnreads'] ?? 0); - $myFeed->_nbEntries($dao['cache_nbEntries'] ?? 0); + $myFeed->_nbNotRead($dao['cache_nbUnreads'] ?? -1); + $myFeed->_nbEntries($dao['cache_nbEntries'] ?? -1); if (isset($dao['id'])) { $myFeed->_id($dao['id']); } -- cgit v1.2.3