Added escape to cron upload to stop the process when a transaction-breaking error occurs.

This commit is contained in:
matthew 2019-06-02 13:38:25 -05:00
parent 38badf7e45
commit aef455949b

View File

@ -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;
}
}
}