1
1
Fork 0

More list sub commands

This commit is contained in:
nupplaPhil 2020-02-25 22:28:02 +01:00
parent 2adc6a0974
commit 3a317c5c0d
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
2 changed files with 14 additions and 5 deletions

View file

@ -28,6 +28,7 @@ use Friendica\Core\L10n;
use Friendica\Database\Database;
use Friendica\Model\Register;
use Friendica\Model\User as UserModel;
use Friendica\Util\Temporal;
use RuntimeException;
use Seld\CliPrompt\CliPrompt;
@ -64,6 +65,7 @@ Usage
bin/console user block [<nickname>] [-h|--help|-?] [-v]
bin/console user unblock [<nickname>] [-h|--help|-?] [-v]
bin/console user list pending [start=0 [count=50]] [-h|--help|-?] [-v]
bin/console user list removed [start=0 [count=50]] [-h|--help|-?] [-v]
bin/console user list all [start=0 [count=50]] [-h|--help|-?] [-v]
Description
@ -333,24 +335,31 @@ HELP;
$contact['name'],
$contact['url'],
$contact['email'],
$contact['created'],
Temporal::getRelativeDate($contact['created']),
$contact['note'],
]);
}
$this->out($table->getTable());
return true;
case 'all':
case 'removed':
default:
$table->setHeaders(['Nick', 'Name', 'URL', 'E-Mail', 'Register Date', 'Comment']);
$table->setHeaders(['Nick', 'Name', 'URL', 'E-Mail', 'Register', 'Login', 'Last Item']);
$contacts = UserModel::getUsers($start, $count);
foreach ($contacts as $contact) {
if (($subCmd != 'removed') && !empty($contact['account_removed']) ||
($subCmd == 'removed') && empty($contact['account_removed'])) {
continue;
}
$table->addRow([
$contact['nick'],
$contact['name'],
$contact['url'],
$contact['email'],
$contact['created'],
$contact['note'],
Temporal::getRelativeDate($contact['created']),
Temporal::getRelativeDate($contact['login_date']),
Temporal::getRelativeDate($contact['lastitem_date']),
]);
}
$this->out($table->getTable());

View file

@ -1334,7 +1334,7 @@ class User
$sql_order = '`' . str_replace('.', '`.`', $order) . '`';
$sql_order_direction = ($order_direction === '+') ? 'ASC' : 'DESC';
$usersStmt = DBA::p("SELECT `user`.*, `contact`.`name`, `contact`.`url`, `contact`.`micro`, `user`.`account_expired`, `contact`.`last-item` AS `lastitem_date`, `contact`.`nick`
$usersStmt = DBA::p("SELECT `user`.*, `contact`.`name`, `contact`.`url`, `contact`.`micro`, `user`.`account_expired`, `contact`.`last-item` AS `lastitem_date`, `contact`.`nick`, `contact`.`created`
FROM `user`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
WHERE `user`.`verified`