aboutsummaryrefslogtreecommitdiff
path: root/cli/user-info.php
blob: dd38e6c7f715757bcd54e59556565185b347fb00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/php
<?php
require('_cli.php');

$options = getopt('h', array(
		'user:',
	));

if (empty($options['user'])) {
	fail('Usage: ' . basename(__FILE__) . " -h --user username");
}

$users = $options['user'] === '*' ? listUsers() : array($options['user']);

foreach ($users as $username) {
	$username = cliInitUser($username);

	$entryDAO = FreshRSS_Factory::createEntryDao($username);

	echo $username === FreshRSS_Context::$system_conf->default_user ? '*' : ' ', "\t";

	if (isset($options['h'])) {	//Human format
		echo
			$username, "\t",
			date('c', FreshRSS_UserDAO::mtime($username)), "\t",
			format_bytes($entryDAO->size()), "\t",
			"\n";
	} else {
		echo
			$username, "\t",
			FreshRSS_UserDAO::mtime($username), "\t",
			$entryDAO->size(), "\t",
			"\n";
	}
}