From be4c942cb3bd2b41dc2e01eb437dfd4f2f73ab4a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 6 Oct 2019 00:14:19 +0200 Subject: SQL allow recreating existing user (#2555) * SQL allow recreating existing user Taking advantage of https://github.com/FreshRSS/FreshRSS/pull/2554 In a case when FreshRSS data is lost, but database data still intact (in particular MySQL or PostgreSQL), this patch allows recreating previous users without error * Better error retrieval Especially when error occur during the prepare statement --- app/Models/UserDAO.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Models/UserDAO.php') diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 7580de06e..8e7e977d0 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -27,7 +27,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { if ($ok) { return true; } else { - $info = empty($stm) ? array(2 => 'syntax error') : $stm->errorInfo(); + $info = empty($stm) ? $this->pdo->errorInfo() : $stm->errorInfo(); Minz_Log::error(__METHOD__ . ' error: ' . $info[2]); return false; } @@ -45,7 +45,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { if ($ok) { return true; } else { - $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + $info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo(); Minz_Log::error(__METHOD__ . ' error: ' . $info[2]); return false; } -- cgit v1.2.3