Sfoglia il codice sorgente

DB: auto-add lastUserModified column also during markRead (#8346)

fix https://github.com/FreshRSS/FreshRSS/issues/8345
Alexandre Alapetite 3 mesi fa
parent
commit
6fb5263633
2 ha cambiato i file con 22 aggiunte e 7 eliminazioni
  1. 14 4
      app/Models/EntryDAO.php
  2. 8 3
      app/Models/EntryDAOSQLite.php

+ 14 - 4
app/Models/EntryDAO.php

@@ -491,8 +491,13 @@ SQL;
 			$stm = $this->pdo->prepare($sql);
 			if ($stm === false || !$stm->execute($values)) {
 				$info = $stm === false ? $this->pdo->errorInfo() : $stm->errorInfo();
-				Minz_Log::error('SQL error ' . __METHOD__ . ' A ' . json_encode($info));
-				return false;
+				/** @var array{0:string,1:int,2:string} $info */
+				if ($this->autoUpdateDb($info)) {
+					return $this->markRead($ids, $is_read);
+				} else {
+					Minz_Log::error('SQL error ' . __METHOD__ . ' A ' . json_encode($info));
+					return false;
+				}
 			}
 			$affected = $stm->rowCount();
 			if (($affected > 0) && (!$this->updateCacheUnreads(null, null))) {
@@ -511,8 +516,13 @@ SQL;
 				return $stm->rowCount();
 			} else {
 				$info = $stm === false ? $this->pdo->errorInfo() : $stm->errorInfo();
-				Minz_Log::error('SQL error ' . __METHOD__ . ' B ' . json_encode($info));
-				return false;
+				/** @var array{0:string,1:int,2:string} $info */
+				if ($this->autoUpdateDb($info)) {
+					return $this->markRead($ids, $is_read);
+				} else {
+					Minz_Log::error('SQL error ' . __METHOD__ . ' B ' . json_encode($info));
+					return false;
+				}
 			}
 		}
 	}

+ 8 - 3
app/Models/EntryDAOSQLite.php

@@ -134,9 +134,14 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
 			$stm = $this->pdo->prepare($sql);
 			if ($stm === false || !$stm->execute($values)) {
 				$info = $stm === false ? $this->pdo->errorInfo() : $stm->errorInfo();
-				Minz_Log::error('SQL error ' . __METHOD__ . ' A ' . json_encode($info));
-				$this->pdo->rollBack();
-				return false;
+				/** @var array{0:string,1:int,2:string} $info */
+				if ($this->autoUpdateDb($info)) {
+					return $this->markRead($ids, $is_read);
+				} else {
+					Minz_Log::error('SQL error ' . __METHOD__ . ' A ' . json_encode($info));
+					$this->pdo->rollBack();
+					return false;
+				}
 			}
 			$affected = $stm->rowCount();
 			if ($affected > 0) {