diff options
| author | 2025-11-26 23:47:29 +0100 | |
|---|---|---|
| committer | 2025-11-26 23:47:29 +0100 | |
| commit | 5e0093aa00a6b52df88f526a5b6f737eff057e0b (patch) | |
| tree | 3c86ea76d3dd3f7f0b5e84aec7b0eedb78daccbf /app/Models | |
| parent | b3cfc387b8f0583eb652a9d61691dbc6119771ea (diff) | |
Fix MariaDB updateCachedValues (#8255)
Changed syntax for an even wider compatibility.
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/8254
Regression from https://github.com/FreshRSS/FreshRSS/pull/6957
MariaDB images on Docker Hub go back to 10.6, so changed documentation to indicate support from that version, as I cannot easily test even older versions.
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/FeedDAO.php | 7 | ||||
| -rw-r--r-- | app/Models/FeedDAOPGSQL.php | 1 |
2 files changed, 4 insertions, 4 deletions
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index dcabf337b..a2c64977f 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -487,7 +487,8 @@ SQL; $whereEntryIdFeeds = 'id_feed IN (' . str_repeat('?,', count($feedIds) - 1) . '?)'; } $sql = <<<SQL - WITH entry_counts AS ( + UPDATE `_feed` + LEFT JOIN ( SELECT id_feed, COUNT(*) AS total_entries, @@ -495,9 +496,7 @@ SQL; FROM `_entry` WHERE $whereEntryIdFeeds GROUP BY id_feed - ) - UPDATE `_feed` - LEFT JOIN entry_counts ON entry_counts.id_feed = `_feed`.id + ) AS 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 diff --git a/app/Models/FeedDAOPGSQL.php b/app/Models/FeedDAOPGSQL.php index d09d2e1c9..07fbbf31d 100644 --- a/app/Models/FeedDAOPGSQL.php +++ b/app/Models/FeedDAOPGSQL.php @@ -13,6 +13,7 @@ SQL; #[\Override] public function updateCachedValues(int ...$feedIds): int|false { + // Compatible PostgreSQL, SQLite, MySQL 8.0+, but not MariaDB as of version 12.2. if (empty($feedIds)) { $whereFeedIds = 'true'; $whereEntryIdFeeds = 'true'; |
