aboutsummaryrefslogtreecommitdiff
path: root/app/Models/DatabaseDAOSQLite.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-10-31 18:15:47 +0100
committerGravatar GitHub <noreply@github.com> 2019-10-31 18:15:47 +0100
commit3aa66f317b496ccd9a2df914bbc747c52081a7ad (patch)
tree6a3f3f74899801abdca00546e213dfdc141c53cf /app/Models/DatabaseDAOSQLite.php
parent82611c9622ed23b0e9fcf5f9f651ddffa1fd7706 (diff)
parentfcae48f313d399050cb15f37a8a73ae52fc67796 (diff)
Merge pull request #2599 from FreshRSS/dev1.15.0
FreshRSS 1.15
Diffstat (limited to 'app/Models/DatabaseDAOSQLite.php')
-rw-r--r--app/Models/DatabaseDAOSQLite.php36
1 files changed, 18 insertions, 18 deletions
diff --git a/app/Models/DatabaseDAOSQLite.php b/app/Models/DatabaseDAOSQLite.php
index a93a209b2..413e7ee09 100644
--- a/app/Models/DatabaseDAOSQLite.php
+++ b/app/Models/DatabaseDAOSQLite.php
@@ -6,17 +6,16 @@
class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
public function tablesAreCorrect() {
$sql = 'SELECT name FROM sqlite_master WHERE type="table"';
- $stm = $this->bd->prepare($sql);
- $stm->execute();
+ $stm = $this->pdo->query($sql);
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
$tables = array(
- 'category' => false,
- 'feed' => false,
- 'entry' => false,
- 'entrytmp' => false,
- 'tag' => false,
- 'entrytag' => false,
+ $this->pdo->prefix() . 'category' => false,
+ $this->pdo->prefix() . 'feed' => false,
+ $this->pdo->prefix() . 'entry' => false,
+ $this->pdo->prefix() . 'entrytmp' => false,
+ $this->pdo->prefix() . 'tag' => false,
+ $this->pdo->prefix() . 'entrytag' => false,
);
foreach ($res as $value) {
$tables[$value['name']] = true;
@@ -27,9 +26,7 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
public function getSchema($table) {
$sql = 'PRAGMA table_info(' . $table . ')';
- $stm = $this->bd->prepare($sql);
- $stm->execute();
-
+ $stm = $this->pdo->query($sql);
return $this->listDaoToSchema($stm->fetchAll(PDO::FETCH_ASSOC));
}
@@ -57,15 +54,18 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
}
public function size($all = false) {
- return @filesize(join_path(DATA_PATH, 'users', $this->current_user, 'db.sqlite'));
+ $sum = 0;
+ if ($all) {
+ foreach (glob(DATA_PATH . '/users/*/db.sqlite') as $filename) {
+ $sum += @filesize($filename);
+ }
+ } else {
+ $sum = @filesize(DATA_PATH . '/users/' . $this->current_user . '/db.sqlite');
+ }
+ return $sum;
}
public function optimize() {
- $sql = 'VACUUM';
- $stm = $this->bd->prepare($sql);
- if ($stm) {
- return $stm->execute();
- }
- return false;
+ return $this->pdo->exec('VACUUM') !== false;
}
}