From 6fb60d470aaa3c1e62dc1a61f786abdd6e428106 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 11 Nov 2019 19:48:23 +0100 Subject: Fix DB optimize for MySQL (#2647) `pdo->exec()` is not appropriate for MySQL `OPTIMIZE` because `OPTIMIZE` returns some data and not only a code and then fails. --- app/Models/DatabaseDAOPGSQL.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/Models/DatabaseDAOPGSQL.php') diff --git a/app/Models/DatabaseDAOPGSQL.php b/app/Models/DatabaseDAOPGSQL.php index 7ca7799ae..75ff8be7b 100644 --- a/app/Models/DatabaseDAOPGSQL.php +++ b/app/Models/DatabaseDAOPGSQL.php @@ -79,7 +79,11 @@ class FreshRSS_DatabaseDAOPGSQL extends FreshRSS_DatabaseDAOSQLite { foreach ($tables as $table) { $sql = 'VACUUM `_' . $table . '`'; - $ok &= ($this->pdo->exec($sql) !== false); + if ($this->pdo->exec($sql) === false) { + $ok = false; + $info = $this->pdo->errorInfo(); + Minz_Log::warning(__METHOD__ . ' error: ' . $sql . ' : ' . json_encode($info)); + } } return $ok; } -- cgit v1.2.3