]> git.mxchange.org Git - friendica.git/commitdiff
More list sub commands
authornupplaPhil <admin+github@philipp.info>
Tue, 25 Feb 2020 21:28:02 +0000 (22:28 +0100)
committernupplaPhil <admin+github@philipp.info>
Sat, 29 Feb 2020 16:10:32 +0000 (17:10 +0100)
src/Console/User.php
src/Model/User.php

index 3fdeac1c5631a02ed3ccbed7c5e98a3d9924aa6d..68e25818b1246041ad50db38d612c3101e49ad01 100644 (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());
index 85a999b37b54adf0840cb76fef1b5d6c287d2e07..b0db51a11b0584a87fb8f949a73a38a58de6c436 100644 (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`