From 412b60ca8380dd760225574746207cf8e90a2b43 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 19 Sep 2022 11:51:44 +0200 Subject: Fix transaction rollbacks during auto-update (#4622) #fix https://github.com/FreshRSS/FreshRSS/issues/4600 We first need to commit the SQL transaction before being able to auto-update. Avoid error such as: > 25P02: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block --- app/Models/CategoryDAO.php | 3 +++ app/Models/EntryDAO.php | 3 +++ app/Models/FeedDAO.php | 3 +++ 3 files changed, 9 insertions(+) (limited to 'app') diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index e9b873d72..e098c65e4 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -15,6 +15,9 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable } protected function addColumn($name) { + if ($this->pdo->inTransaction()) { + $this->pdo->commit(); + } Minz_Log::warning(__method__ . ': ' . $name); try { if ($name === 'kind') { //v1.20.0 diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 424f682a8..b63515223 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -62,6 +62,9 @@ SQL; } protected function addColumn(string $name) { + if ($this->pdo->inTransaction()) { + $this->pdo->commit(); + } Minz_Log::warning(__method__ . ': ' . $name); try { if ($name === 'attributes') { //v1.20.0 diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 1b3d84c46..9f85fbc86 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -3,6 +3,9 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { protected function addColumn(string $name) { + if ($this->pdo->inTransaction()) { + $this->pdo->commit(); + } Minz_Log::warning(__method__ . ': ' . $name); try { if ($name === 'kind') { //v1.20.0 -- cgit v1.2.3