mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-04-15 11:57:19 -04:00
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
This commit is contained in:
committed by
GitHub
parent
1b15e22897
commit
be4c942cb3
@@ -88,7 +88,7 @@ DROP TABLE IF EXISTS `tmp`;
|
||||
if ($stm && $stm->execute($values)) {
|
||||
return true;
|
||||
} else {
|
||||
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
$info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
|
||||
Minz_Log::error('SQL error updateCacheUnreads: ' . $info[2]);
|
||||
return false;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ DROP TABLE IF EXISTS `tmp`;
|
||||
$values = array($is_read ? 1 : 0, $ids, $is_read ? 0 : 1);
|
||||
$stm = $this->pdo->prepare($sql);
|
||||
if (!($stm && $stm->execute($values))) {
|
||||
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
$info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
|
||||
Minz_Log::error('SQL error markRead 1: ' . $info[2]);
|
||||
$this->pdo->rollBack();
|
||||
return false;
|
||||
@@ -135,7 +135,7 @@ DROP TABLE IF EXISTS `tmp`;
|
||||
$values = array($ids);
|
||||
$stm = $this->pdo->prepare($sql);
|
||||
if (!($stm && $stm->execute($values))) {
|
||||
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
$info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
|
||||
Minz_Log::error('SQL error markRead 2: ' . $info[2]);
|
||||
$this->pdo->rollBack();
|
||||
return false;
|
||||
@@ -186,7 +186,7 @@ DROP TABLE IF EXISTS `tmp`;
|
||||
|
||||
$stm = $this->pdo->prepare($sql . $search);
|
||||
if (!($stm && $stm->execute(array_merge($values, $searchValues)))) {
|
||||
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
$info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
|
||||
Minz_Log::error('SQL error markReadEntries: ' . $info[2]);
|
||||
return false;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ DROP TABLE IF EXISTS `tmp`;
|
||||
|
||||
$stm = $this->pdo->prepare($sql . $search);
|
||||
if (!($stm && $stm->execute(array_merge($values, $searchValues)))) {
|
||||
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
$info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
|
||||
Minz_Log::error('SQL error markReadCat: ' . $info[2]);
|
||||
return false;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ DROP TABLE IF EXISTS `tmp`;
|
||||
|
||||
$stm = $this->pdo->prepare($sql . $search);
|
||||
if (!($stm && $stm->execute(array_merge($values, $searchValues)))) {
|
||||
$info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
|
||||
$info = $stm == null ? $this->pdo->errorInfo() : $stm->errorInfo();
|
||||
Minz_Log::error('SQL error markReadTag: ' . $info[2]);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user