Ver Fonte

CLI: More infos in user-info

https://github.com/FreshRSS/FreshRSS/issues/1449#issuecomment-283927614
Alexandre Alapetite há 9 anos atrás
pai
commit
ada94465e6
2 ficheiros alterados com 17 adições e 2 exclusões
  1. 2 1
      cli/README.md
  2. 15 1
      cli/user-info.php

+ 2 - 1
cli/README.md

@@ -63,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
 ```
 
 

+ 15 - 1
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";
 	}
 }