diff options
| author | 2017-10-12 20:11:06 +0200 | |
|---|---|---|
| committer | 2017-10-12 20:11:06 +0200 | |
| commit | f632a346269100d6a93bef318ffa66c97f16f6fa (patch) | |
| tree | affdcac8889fcaeb04c9934a37ae6f3a5422c0ea /app/Models/DatabaseDAOSQLite.php | |
| parent | 6372e51cd6a6846c11366b5b5f56409198af6e24 (diff) | |
CLI optimize database (#1663)
CLI optimize database https://github.com/FreshRSS/FreshRSS/issues/1583
And VACUUM in SQLite https://github.com/FreshRSS/FreshRSS/issues/918
Add VACUUM for PostgreSQL (Not tested yet)
Diffstat (limited to 'app/Models/DatabaseDAOSQLite.php')
| -rw-r--r-- | app/Models/DatabaseDAOSQLite.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/Models/DatabaseDAOSQLite.php b/app/Models/DatabaseDAOSQLite.php index 2e1df132e..d3aedb3c0 100644 --- a/app/Models/DatabaseDAOSQLite.php +++ b/app/Models/DatabaseDAOSQLite.php @@ -45,4 +45,17 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO { 'default' => $dao['dflt_value'], ); } + + public function size($all = false) { + return @filesize(join_path(DATA_PATH, 'users', $this->current_user, 'db.sqlite')); + } + + public function optimize() { + $sql = 'VACUUM'; + $stm = $this->bd->prepare($sql); + if ($stm) { + return $stm->execute(); + } + return false; + } } |
