aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-03-04 11:55:47 +0100
committerGravatar GitHub <noreply@github.com> 2017-03-04 11:55:47 +0100
commit6bbe89e9bc5ae5adf3d163923faa03c9207bd9e2 (patch)
treef14e842fbc320d3f3c1331dae62eb7e24aaf2517 /cli
parent29b4fbcf0abff1cff13b53d6b01e79e14de4c7f9 (diff)
parent2818c72f5ae00276a083d0c24454394e9d064c7c (diff)
Merge pull request #1447 from Alkarex/CLI-bugs
Fix CLI bugs
Diffstat (limited to 'cli')
-rw-r--r--cli/README.md6
-rwxr-xr-xcli/do-install.php7
-rwxr-xr-xcli/list-users.php2
-rwxr-xr-xcli/reconfigure.php1
-rwxr-xr-xcli/user-info.php16
5 files changed, 27 insertions, 5 deletions
diff --git a/cli/README.md b/cli/README.md
index 5662e2d83..5434d1964 100644
--- a/cli/README.md
+++ b/cli/README.md
@@ -32,10 +32,11 @@ Options in parenthesis are optional.
```sh
cd /usr/share/FreshRSS
-./cli/do-install.php --default_user admin ( --auth_type form --environment production --base_url https://rss.example.net/ --title FreshRSS --allow_anonymous --api_enabled --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123 --db-base freshrss --db-prefix freshrss )
+./cli/do-install.php --default_user admin ( --auth_type form --environment production --base_url https://rss.example.net/ --language en --title FreshRSS --allow_anonymous --api_enabled --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123 --db-base freshrss --db-prefix freshrss )
# --auth_type can be: 'form' (default), 'http_auth' (using the Web server access control), 'none' (dangerous)
# --db-type can be: 'sqlite' (default), 'mysql' (MySQL or MariaDB), 'pgsql' (PostgreSQL)
# --environment can be: 'production' (default), 'development' (for additional log messages)
+# --language can be: 'en' (default), 'fr', or one of the [supported languages](../app/i18n/)
# --db-prefix is an optional prefix in front of the names of the tables. We suggest using 'freshrss_'
# This command does not create the default user. Do that with ./cli/create-user.php
@@ -62,7 +63,8 @@ cd /usr/share/FreshRSS
./cli/user-info.php -h --user username
# -h is to use a human-readable format
# --user can be a username, or '*' to loop on all users
-# Returns a * if the user is admin, the name of the user, the date/time of last action, and the size occupied
+# Returns a * if the user is admin, the name of the user, the date/time of last action, the size occupied,
+# and the number of: feeds, read articles, unread articles, and favourites
```
diff --git a/cli/do-install.php b/cli/do-install.php
index 16d03daaf..143ca5c3e 100755
--- a/cli/do-install.php
+++ b/cli/do-install.php
@@ -3,9 +3,14 @@
require('_cli.php');
require(LIB_PATH . '/lib_install.php');
+if (!file_exists(DATA_PATH . '/do-install.txt')) {
+ fail('FreshRSS looks to be already installed! Please use `./cli/reconfigure.php` instead.');
+}
+
$params = array(
'environment:',
'base_url:',
+ 'language:',
'title:',
'default_user:',
'allow_anonymous',
@@ -30,7 +35,7 @@ $options = getopt('', array_merge($params, $dBparams));
if (empty($options['default_user'])) {
fail('Usage: ' . basename(__FILE__) . " --default_user admin ( --auth_type form" .
" --environment production --base_url https://rss.example.net/" .
- " --title FreshRSS --allow_anonymous --api_enabled" .
+ " --language en --title FreshRSS --allow_anonymous --api_enabled" .
" --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123" .
" --db-base freshrss --db-prefix freshrss_ --disable_update )");
}
diff --git a/cli/list-users.php b/cli/list-users.php
index e690ff451..610a9dd7b 100755
--- a/cli/list-users.php
+++ b/cli/list-users.php
@@ -4,7 +4,7 @@ require('_cli.php');
$users = listUsers();
sort($users);
-if (FreshRSS_Context::$system_conf->default_user !== '') {
+if (FreshRSS_Context::$system_conf->default_user !== '' && in_array(FreshRSS_Context::$system_conf->default_user, $users, true)) {
array_unshift($users, FreshRSS_Context::$system_conf->default_user);
$users = array_unique($users);
}
diff --git a/cli/reconfigure.php b/cli/reconfigure.php
index da451b3ef..c6902da67 100755
--- a/cli/reconfigure.php
+++ b/cli/reconfigure.php
@@ -5,6 +5,7 @@ require('_cli.php');
$params = array(
'environment:',
'base_url:',
+ 'language:',
'title:',
'default_user:',
'allow_anonymous',
diff --git a/cli/user-info.php b/cli/user-info.php
index dd38e6c7f..aa3e239b8 100755
--- a/cli/user-info.php
+++ b/cli/user-info.php
@@ -14,22 +14,36 @@ $users = $options['user'] === '*' ? listUsers() : array($options['user']);
foreach ($users as $username) {
$username = cliInitUser($username);
+ echo $username === FreshRSS_Context::$system_conf->default_user ? '*' : ' ', "\t";
+ $catDAO = new FreshRSS_CategoryDAO();
+ $feedDAO = FreshRSS_Factory::createFeedDao($username);
$entryDAO = FreshRSS_Factory::createEntryDao($username);
- echo $username === FreshRSS_Context::$system_conf->default_user ? '*' : ' ', "\t";
+ $nbEntries = $entryDAO->countUnreadRead();
+ $nbFavorites = $entryDAO->countUnreadReadFavorites();
if (isset($options['h'])) { //Human format
echo
$username, "\t",
date('c', FreshRSS_UserDAO::mtime($username)), "\t",
format_bytes($entryDAO->size()), "\t",
+ $catDAO->count(), " categories\t",
+ count($feedDAO->listFeedsIds()), " feeds\t",
+ $nbEntries['read'], " reads\t",
+ $nbEntries['unread'], " unreads\t",
+ $nbFavorites['all'], " favourites\t",
"\n";
} else {
echo
$username, "\t",
FreshRSS_UserDAO::mtime($username), "\t",
$entryDAO->size(), "\t",
+ $catDAO->count(), "\t",
+ count($feedDAO->listFeedsIds()), "\t",
+ $nbEntries['read'], "\t",
+ $nbEntries['unread'], "\t",
+ $nbFavorites['all'], "\t",
"\n";
}
}