aboutsummaryrefslogtreecommitdiff
path: root/app/Models/FeedDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-11-26 16:47:40 +0100
committerGravatar GitHub <noreply@github.com> 2025-11-26 16:47:40 +0100
commitb3cfc387b8f0583eb652a9d61691dbc6119771ea (patch)
tree3db57add5ce115445b6259ddbae4cb493d353920 /app/Models/FeedDAO.php
parentfbfc5eacadc1fada6a538690e2949ad3c49bde4f (diff)
Fix MariaDB for updates (#8254)
fix https://github.com/FreshRSS/FreshRSS/issues/8252 regression from https://github.com/FreshRSS/FreshRSS/pull/6957 The current code works with MySQL 8+ (as well as PostgreSQL and SQLite), but not with MariaDB, because MariaDB does not support CTE (Common Table Expression) fully (which I was not aware of)...
Diffstat (limited to 'app/Models/FeedDAO.php')
-rw-r--r--app/Models/FeedDAO.php13
1 files changed, 3 insertions, 10 deletions
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index ddc2057db..dcabf337b 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -497,16 +497,9 @@ SQL;
GROUP BY id_feed
)
UPDATE `_feed`
- SET `cache_nbEntries` = COALESCE((
- SELECT c.total_entries
- FROM entry_counts AS c
- WHERE c.id_feed = `_feed`.id
- ), 0),
- `cache_nbUnreads` = COALESCE((
- SELECT c.unread_entries
- FROM entry_counts AS c
- WHERE c.id_feed = `_feed`.id
- ), 0)
+ LEFT JOIN entry_counts ON entry_counts.id_feed = `_feed`.id
+ SET `cache_nbEntries` = COALESCE(entry_counts.total_entries, 0),
+ `cache_nbUnreads` = COALESCE(entry_counts.unread_entries, 0)
WHERE $whereFeedIds
SQL;
$stm = $this->pdo->prepare($sql);