From: nupplaPhil Date: Tue, 25 Feb 2020 21:28:02 +0000 (+0100) Subject: More list sub commands X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3a317c5c0dbcb159f02bac339261bedbd351078a;p=friendica.git More list sub commands --- diff --git a/src/Console/User.php b/src/Console/User.php index 3fdeac1c56..68e25818b1 100644 --- a/src/Console/User.php +++ b/src/Console/User.php @@ -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 [] [-h|--help|-?] [-v] bin/console user unblock [] [-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()); diff --git a/src/Model/User.php b/src/Model/User.php index 85a999b37b..b0db51a11b 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -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`