aboutsummaryrefslogtreecommitdiff
path: root/app/Models/DatabaseDAOSQLite.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-11-11 19:48:23 +0100
committerGravatar GitHub <noreply@github.com> 2019-11-11 19:48:23 +0100
commit6fb60d470aaa3c1e62dc1a61f786abdd6e428106 (patch)
tree94fcfc624d980c6a59538130fed7a0e71339cdf1 /app/Models/DatabaseDAOSQLite.php
parent6a643d180ec7e05deb4d86a4a8d128dda0360345 (diff)
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.
Diffstat (limited to 'app/Models/DatabaseDAOSQLite.php')
-rw-r--r--app/Models/DatabaseDAOSQLite.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/Models/DatabaseDAOSQLite.php b/app/Models/DatabaseDAOSQLite.php
index 413e7ee09..eaa2d37a7 100644
--- a/app/Models/DatabaseDAOSQLite.php
+++ b/app/Models/DatabaseDAOSQLite.php
@@ -66,6 +66,11 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
}
public function optimize() {
- return $this->pdo->exec('VACUUM') !== false;
+ $ok = $this->pdo->exec('VACUUM') !== false;
+ if (!$ok) {
+ $info = $this->pdo->errorInfo();
+ Minz_Log::warning(__METHOD__ . ' error: ' . $sql . ' : ' . json_encode($info));
+ }
+ return $ok;
}
}