A free, self-hostable news aggregator…
Add lang and mail in CLI user-info (#2958)
Alexandre Alapetite2bbc579d726a
diff --git a/cli/README.md b/cli/README.mdindex 1e9e72d4d..a4d70b779 100644--- a/cli/README.md+++ b/cli/README.md@@ -61,12 +61,14 @@ cd /usr/share/FreshRSS./cli/list-users.php# Return a list of users, with the default/admin user first-./cli/user-info.php -h --user username+./cli/user-info.php -h --header --user username1 --user username2 ...# -h is to use a human-readable format-# --user can be a username, or '*' to loop on all users-# Returns: 1) a * iff the user is admin, 2) the name of the user,+# --header outputs some columns headers+# --user indicates a username, and can be repeated+# Returns: 1) a * if the user is admin, 2) the name of the user,# 3) the date/time of last user action, 4) the size occupied,-# and the number of: 5) categories, 6) feeds, 7) read articles, 8) unread articles, 9) favourites, and 10) tags+# and the number of: 5) categories, 6) feeds, 7) read articles, 8) unread articles, 9) favourites, 10) tags,+# 11) language, 12) e-mail./cli/import-for-user.php --user username --filename /path/to/file.ext# The extension of the file { .json, .opml, .xml, .zip } is used to detect the type of import@@ -88,7 +90,7 @@ cd /usr/share/FreshRSS### Note about cron-Some commands display informations on standard error, cron will send an email with thoses informations every time the command will be executed (exited zero or non-zero).+Some commands display information on standard error; cron will send an email with this information every time the command will be executed (exited zero or non-zero).To avoid cron sending email on success:diff --git a/cli/user-info.php b/cli/user-info.phpindex f56bd9aa5..2123c1b99 100755--- a/cli/user-info.php+++ b/cli/user-info.php@@ -2,7 +2,7 @@<?phprequire(__DIR__ . '/_cli.php');-const DATA_FORMAT = "%-7s | %-20s | %-25s | %-15s | %-10s | %-10s | %-10s | %-10s | %-10s | %-10s\n";+const DATA_FORMAT = "%-7s | %-20s | %-25s | %-15s | %-10s | %-10s | %-10s | %-10s | %-10s | %-10s | %-5s | %-10s\n";$params = array('user:',@@ -29,20 +29,23 @@ if (array_key_exists('header', $options)) {DATA_FORMAT,'default','user',- 'last update',+ 'last user activity','space used','categories','feeds','reads','unreads','favourites',- 'tags'+ 'tags',+ 'lang',+ 'email');}foreach ($users as $username) {$username = cliInitUser($username);+ $userConfiguration = get_user_configuration($username);$catDAO = FreshRSS_Factory::createCategoryDao($username);$feedDAO = FreshRSS_Factory::createFeedDao($username);$entryDAO = FreshRSS_Factory::createEntryDao($username);@@ -55,18 +58,20 @@ foreach ($users as $username) {$data = array('default' => $username === FreshRSS_Context::$system_conf->default_user ? '*' : '','user' => $username,- 'lastUpdate' => FreshRSS_UserDAO::mtime($username),- 'spaceUsed' => $databaseDAO->size(),+ 'last_user_activity' => FreshRSS_UserDAO::mtime($username),+ 'database_size' => $databaseDAO->size(),'categories' => $catDAO->count(),'feeds' => count($feedDAO->listFeedsIds()),'reads' => $nbEntries['read'],'unreads' => $nbEntries['unread'],'favourites' => $nbFavorites['all'],'tags' => $tagDAO->count(),+ 'lang' => $userConfiguration->language,+ 'mail_login' => $userConfiguration->mail_login,);if (isset($options['h'])) { //Human format- $data['lastUpdate'] = date('c', $data['lastUpdate']);- $data['spaceUsed'] = format_bytes($data['spaceUsed']);+ $data['last_user_activity'] = date('c', $data['last_user_activity']);+ $data['database_size'] = format_bytes($data['database_size']);}vprintf(DATA_FORMAT, $data);}