diff options
| author | 2023-12-03 19:52:02 +0100 | |
|---|---|---|
| committer | 2023-12-03 19:52:02 +0100 | |
| commit | f0d4f2762d2b74eeadf2fb64ff83039b5cc16c26 (patch) | |
| tree | ebdb0bcffeb4370d1fa08defe7313dbf5f02e47a /app/Models/EntryDAO.php | |
| parent | eb2c2d9a01ba54865b944f75d8436f933ed3ebfc (diff) | |
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
Diffstat (limited to 'app/Models/EntryDAO.php')
| -rw-r--r-- | app/Models/EntryDAO.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 403f4e493..23ac3c918 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -274,6 +274,26 @@ SQL; } /** + * Count the number of new entries in the temporary table (which have not yet been committed), grouped by feed ID. + * @return array<int,int> + */ + public function newUnreadEntriesPerFeed(): array { + $sql = <<<'SQL' + SELECT id_feed, COUNT(id) AS nb_entries FROM `_entrytmp` + WHERE is_read = 0 + GROUP BY id_feed + SQL; + $lines = $this->fetchAssoc($sql) ?? []; + $result = []; + foreach ($lines as $line) { + if (!empty($line['id_feed'])) { + $result[(int)$line['id_feed']] = (int)($line['nb_entries'] ?? 0); + } + } + return $result; + } + + /** * Toggle favorite marker on one or more article * * @todo simplify the query by removing the str_repeat. I am pretty sure |
