From f632a346269100d6a93bef318ffa66c97f16f6fa Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 12 Oct 2017 20:11:06 +0200 Subject: 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) --- cli/user-info.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cli/user-info.php') diff --git a/cli/user-info.php b/cli/user-info.php index aa3e239b8..41b95cbf3 100755 --- a/cli/user-info.php +++ b/cli/user-info.php @@ -19,6 +19,7 @@ foreach ($users as $username) { $catDAO = new FreshRSS_CategoryDAO(); $feedDAO = FreshRSS_Factory::createFeedDao($username); $entryDAO = FreshRSS_Factory::createEntryDao($username); + $databaseDAO = FreshRSS_Factory::createDatabaseDAO($username); $nbEntries = $entryDAO->countUnreadRead(); $nbFavorites = $entryDAO->countUnreadReadFavorites(); @@ -27,7 +28,7 @@ foreach ($users as $username) { echo $username, "\t", date('c', FreshRSS_UserDAO::mtime($username)), "\t", - format_bytes($entryDAO->size()), "\t", + format_bytes($databaseDAO->size()), "\t", $catDAO->count(), " categories\t", count($feedDAO->listFeedsIds()), " feeds\t", $nbEntries['read'], " reads\t", @@ -38,7 +39,7 @@ foreach ($users as $username) { echo $username, "\t", FreshRSS_UserDAO::mtime($username), "\t", - $entryDAO->size(), "\t", + $databaseDAO->size(), "\t", $catDAO->count(), "\t", count($feedDAO->listFeedsIds()), "\t", $nbEntries['read'], "\t", -- cgit v1.2.3 From 52d09886558361bd818182da9ddc204e83f618ba Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 11 Dec 2017 21:11:34 +0100 Subject: Use __DIR__ for relative include and require For uniformity, and to avoid having PHP searching in include_path. http://php.net/manual/function.include.php https://github.com/FreshRSS/FreshRSS/pull/1715 https://github.com/FreshRSS/FreshRSS/pull/1711#issuecomment-350581350 --- cli/_cli.php | 2 +- cli/_update-or-create-user.php | 2 +- cli/actualize-user.php | 2 +- cli/create-user.php | 2 +- cli/db-optimize.php | 2 +- cli/delete-user.php | 2 +- cli/do-install.php | 2 +- cli/export-opml-for-user.php | 2 +- cli/export-zip-for-user.php | 2 +- cli/import-for-user.php | 2 +- cli/list-users.php | 2 +- cli/reconfigure.php | 2 +- cli/update-user.php | 2 +- cli/user-info.php | 2 +- lib/lib_rss.php | 4 ++-- p/api/greader.php | 2 +- p/api/index.php | 2 +- p/api/pshb.php | 2 +- p/ext.php | 2 +- p/f.php | 2 +- p/i/index.php | 2 +- tests/bootstrap.php | 2 +- 22 files changed, 23 insertions(+), 23 deletions(-) (limited to 'cli/user-info.php') diff --git a/cli/_cli.php b/cli/_cli.php index fb35c4afb..72629171c 100644 --- a/cli/_cli.php +++ b/cli/_cli.php @@ -3,7 +3,7 @@ if (php_sapi_name() !== 'cli') { die('FreshRSS error: This PHP script may only be invoked from command line!'); } -require(dirname(__FILE__) . '/../constants.php'); +require(__DIR__ . '/../constants.php'); require(LIB_PATH . '/lib_rss.php'); require(LIB_PATH . '/lib_install.php'); diff --git a/cli/_update-or-create-user.php b/cli/_update-or-create-user.php index 15397f1f6..a5960b58a 100644 --- a/cli/_update-or-create-user.php +++ b/cli/_update-or-create-user.php @@ -1,5 +1,5 @@ decode($var); @@ -12,7 +12,7 @@ if (!function_exists('json_decode')) { } if (!function_exists('json_encode')) { - require_once('JSON.php'); + require_once(__DIR__ . '/JSON.php'); function json_encode($var) { $JSON = new Services_JSON(); return $JSON->encodeUnsafe($var); diff --git a/p/api/greader.php b/p/api/greader.php index b27f5bd43..99304f4ec 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -20,7 +20,7 @@ Server-side API compatible with Google Reader API layer 2 * https://github.com/theoldreader/api */ -require('../../constants.php'); +require(__DIR__ . '/../../constants.php'); require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader $ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576); diff --git a/p/api/index.php b/p/api/index.php index 08f7b6b7b..429b25225 100644 --- a/p/api/index.php +++ b/p/api/index.php @@ -14,7 +14,7 @@
Your API address: