From aef455949bfce02118dc28897f0fe1705651ebb5 Mon Sep 17 00:00:00 2001 From: matthew Date: Sun, 2 Jun 2019 13:38:25 -0500 Subject: [PATCH] Added escape to cron upload to stop the process when a transaction-breaking error occurs. --- ext/cron_uploader/main.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php index 820ec259..6168e776 100644 --- a/ext/cron_uploader/main.php +++ b/ext/cron_uploader/main.php @@ -273,6 +273,11 @@ class CronUploader extends Extension $this->move_uploaded($img[0], $img[1], false); } catch (Exception $e) { $this->move_uploaded($img[0], $img[1], true); + if (strpos($e->getMessage(), 'SQLSTATE') !== false) { + // Postgres invalidates the transaction if there is an SQL error, + // so all subsequence transactions will fail. + break; + } } }