From b3cfc387b8f0583eb652a9d61691dbc6119771ea Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 26 Nov 2025 16:47:40 +0100 Subject: 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)... --- app/Models/FeedDAOPGSQL.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'app/Models/FeedDAOPGSQL.php') diff --git a/app/Models/FeedDAOPGSQL.php b/app/Models/FeedDAOPGSQL.php index f436a2ec4..d09d2e1c9 100644 --- a/app/Models/FeedDAOPGSQL.php +++ b/app/Models/FeedDAOPGSQL.php @@ -10,4 +10,46 @@ SELECT setval('`_feed_id_seq`', COALESCE(MAX(id), 0) + 1, false) FROM `_feed` SQL; return $this->pdo->exec($sql) !== false; } + + #[\Override] + public function updateCachedValues(int ...$feedIds): int|false { + if (empty($feedIds)) { + $whereFeedIds = 'true'; + $whereEntryIdFeeds = 'true'; + } else { + $whereFeedIds = 'id IN (' . str_repeat('?,', count($feedIds) - 1) . '?)'; + $whereEntryIdFeeds = 'id_feed IN (' . str_repeat('?,', count($feedIds) - 1) . '?)'; + } + $sql = <<pdo->prepare($sql); + if ($stm !== false && $stm->execute(array_merge($feedIds, $feedIds))) { + return $stm->rowCount(); + } else { + $info = $stm === false ? $this->pdo->errorInfo() : $stm->errorInfo(); + Minz_Log::error('SQL error ' . __METHOD__ . json_encode($info)); + return false; + } + } } -- cgit v1.2.3