diff options
| author | 2017-10-12 20:11:06 +0200 | |
|---|---|---|
| committer | 2017-10-12 20:11:06 +0200 | |
| commit | f632a346269100d6a93bef318ffa66c97f16f6fa (patch) | |
| tree | affdcac8889fcaeb04c9934a37ae6f3a5422c0ea /cli/db-optimize.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 'cli/db-optimize.php')
| -rwxr-xr-x | cli/db-optimize.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/db-optimize.php b/cli/db-optimize.php new file mode 100755 index 000000000..83123a669 --- /dev/null +++ b/cli/db-optimize.php @@ -0,0 +1,20 @@ +#!/usr/bin/php +<?php +require('_cli.php'); + +$options = getopt('', array( + 'user:', + )); + +if (empty($options['user'])) { + fail('Usage: ' . basename(__FILE__) . " --user username"); +} + +$username = cliInitUser($options['user']); + +echo 'FreshRSS optimizing database for user “', $username, "”…\n"; + +$databaseDAO = FreshRSS_Factory::createDatabaseDAO($username); +$ok = $databaseDAO->optimize(); + +done($ok); |
