mirror of https://github.com/FreshRSS/FreshRSS.git
Fix SQLite imports produced before FreshRSS 1.20.0
fix https://github.com/FreshRSS/FreshRSS/issues/6088
This commit is contained in:
parent
fa731db286
commit
19a1f0a3a0
|
@ -299,6 +299,7 @@ SQL;
|
|||
|
||||
try {
|
||||
$sqlite = new Minz_PdoSqlite('sqlite:' . $filename);
|
||||
$sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
|
||||
} catch (Exception $e) {
|
||||
$error = 'Error while initialising SQLite copy: ' . $e->getMessage();
|
||||
return self::stdError($error);
|
||||
|
|
|
@ -304,13 +304,19 @@ SELECT id, url, kind, category, name, website, description, `lastUpdate`,
|
|||
FROM `_feed`
|
||||
SQL;
|
||||
$stm = $this->pdo->query($sql);
|
||||
if ($stm === false) {
|
||||
return;
|
||||
}
|
||||
while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {
|
||||
/** @var array{'id':int,'url':string,'kind':int,'category':int,'name':string,'website':string,'description':string,'lastUpdate':int,'priority'?:int,
|
||||
* 'pathEntries'?:string,'httpAuth':string,'error':int|bool,'ttl'?:int,'attributes'?:string} $row */
|
||||
yield $row;
|
||||
if ($stm !== false) {
|
||||
while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {
|
||||
/** @var array{'id':int,'url':string,'kind':int,'category':int,'name':string,'website':string,'description':string,'lastUpdate':int,'priority'?:int,
|
||||
* 'pathEntries'?:string,'httpAuth':string,'error':int|bool,'ttl'?:int,'attributes'?:string} $row */
|
||||
yield $row;
|
||||
}
|
||||
} else {
|
||||
$info = $this->pdo->errorInfo();
|
||||
if ($this->autoUpdateDb($info)) {
|
||||
yield from $this->selectAll();
|
||||
} else {
|
||||
Minz_Log::error(__method__ . ' error: ' . json_encode($info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue