The account overview is now grouped by the account type

This commit is contained in:
Michael 2024-01-23 22:05:14 +00:00
parent 2e5046f8c3
commit dc8b87e008

View File

@ -48,24 +48,23 @@ class Summary extends BaseModeration
protected function content(array $request = []): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();
$accounts = [ $accounts = [
[$this->t('Normal Account'), 0], [$this->t('Personal Page'), 0],
[$this->t('Automatic Follower Account'), 0], [$this->t('Organisation Page'), 0],
[$this->t('Public Group Account'), 0], [$this->t('News Page'), 0],
[$this->t('Automatic Friend Account'), 0], [$this->t('Community Group'), 0],
[$this->t('Blog Account'), 0], [$this->t('Channel Relay'), 0],
[$this->t('Private Group Account'), 0]
]; ];
$users = 0; $users = 0;
$pageFlagsCountStmt = $this->database->p('SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` WHERE `uid` != ? GROUP BY `page-flags`', 0); $accountTypeCountStmt = $this->database->p('SELECT `account-type`, COUNT(`uid`) AS `count` FROM `user` WHERE `uid` != ? GROUP BY `account-type`', 0);
while ($pageFlagsCount = $this->database->fetch($pageFlagsCountStmt)) { while ($AccountTypeCount = $this->database->fetch($accountTypeCountStmt)) {
$accounts[$pageFlagsCount['page-flags']][1] = $pageFlagsCount['count']; $accounts[$AccountTypeCount['account-type']][1] = $AccountTypeCount['count'];
$users += $pageFlagsCount['count']; $users += $AccountTypeCount['count'];
} }
$this->database->close($pageFlagsCountStmt); $this->database->close($accountTypeCountStmt);
$this->logger->debug('accounts', ['accounts' => $accounts]); $this->logger->debug('accounts', ['accounts' => $accounts]);