@@ -39,73 +39,73 @@ |
||
39 | 39 | use Symfony\Component\Console\Output\OutputInterface; |
40 | 40 | |
41 | 41 | class Report extends Command { |
42 | - public const DEFAULT_COUNT_DIRS_MAX_USERS = 500; |
|
42 | + public const DEFAULT_COUNT_DIRS_MAX_USERS = 500; |
|
43 | 43 | |
44 | - /** @var IUserManager */ |
|
45 | - protected $userManager; |
|
46 | - /** @var IConfig */ |
|
47 | - private $config; |
|
44 | + /** @var IUserManager */ |
|
45 | + protected $userManager; |
|
46 | + /** @var IConfig */ |
|
47 | + private $config; |
|
48 | 48 | |
49 | - public function __construct(IUserManager $userManager, |
|
50 | - IConfig $config) { |
|
51 | - $this->userManager = $userManager; |
|
52 | - $this->config = $config; |
|
53 | - parent::__construct(); |
|
54 | - } |
|
49 | + public function __construct(IUserManager $userManager, |
|
50 | + IConfig $config) { |
|
51 | + $this->userManager = $userManager; |
|
52 | + $this->config = $config; |
|
53 | + parent::__construct(); |
|
54 | + } |
|
55 | 55 | |
56 | - protected function configure(): void { |
|
57 | - $this |
|
58 | - ->setName('user:report') |
|
59 | - ->setDescription('shows how many users have access') |
|
60 | - ->addOption( |
|
61 | - 'count-dirs', |
|
62 | - null, |
|
63 | - InputOption::VALUE_NONE, |
|
64 | - 'Also count the number of user directories in the database (could time out on huge installations, therefore defaults to no with ' . self::DEFAULT_COUNT_DIRS_MAX_USERS . '+ users)' |
|
65 | - ) |
|
66 | - ; |
|
67 | - } |
|
56 | + protected function configure(): void { |
|
57 | + $this |
|
58 | + ->setName('user:report') |
|
59 | + ->setDescription('shows how many users have access') |
|
60 | + ->addOption( |
|
61 | + 'count-dirs', |
|
62 | + null, |
|
63 | + InputOption::VALUE_NONE, |
|
64 | + 'Also count the number of user directories in the database (could time out on huge installations, therefore defaults to no with ' . self::DEFAULT_COUNT_DIRS_MAX_USERS . '+ users)' |
|
65 | + ) |
|
66 | + ; |
|
67 | + } |
|
68 | 68 | |
69 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
70 | - $table = new Table($output); |
|
71 | - $table->setHeaders(['User Report', '']); |
|
72 | - $userCountArray = $this->countUsers(); |
|
73 | - $total = 0; |
|
74 | - if (!empty($userCountArray)) { |
|
75 | - $rows = []; |
|
76 | - foreach ($userCountArray as $classname => $users) { |
|
77 | - $total += $users; |
|
78 | - $rows[] = [$classname, $users]; |
|
79 | - } |
|
69 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
70 | + $table = new Table($output); |
|
71 | + $table->setHeaders(['User Report', '']); |
|
72 | + $userCountArray = $this->countUsers(); |
|
73 | + $total = 0; |
|
74 | + if (!empty($userCountArray)) { |
|
75 | + $rows = []; |
|
76 | + foreach ($userCountArray as $classname => $users) { |
|
77 | + $total += $users; |
|
78 | + $rows[] = [$classname, $users]; |
|
79 | + } |
|
80 | 80 | |
81 | - $rows[] = [' ']; |
|
82 | - $rows[] = ['total users', $total]; |
|
83 | - } else { |
|
84 | - $rows[] = ['No backend enabled that supports user counting', '']; |
|
85 | - } |
|
86 | - $rows[] = [' ']; |
|
81 | + $rows[] = [' ']; |
|
82 | + $rows[] = ['total users', $total]; |
|
83 | + } else { |
|
84 | + $rows[] = ['No backend enabled that supports user counting', '']; |
|
85 | + } |
|
86 | + $rows[] = [' ']; |
|
87 | 87 | |
88 | - if ($total <= self::DEFAULT_COUNT_DIRS_MAX_USERS || $input->getOption('count-dirs')) { |
|
89 | - $userDirectoryCount = $this->countUserDirectories(); |
|
90 | - $rows[] = ['user directories', $userDirectoryCount]; |
|
91 | - } |
|
88 | + if ($total <= self::DEFAULT_COUNT_DIRS_MAX_USERS || $input->getOption('count-dirs')) { |
|
89 | + $userDirectoryCount = $this->countUserDirectories(); |
|
90 | + $rows[] = ['user directories', $userDirectoryCount]; |
|
91 | + } |
|
92 | 92 | |
93 | - $disabledUsers = $this->config->getUsersForUserValue('core', 'enabled', 'false'); |
|
94 | - $disabledUsersCount = count($disabledUsers); |
|
95 | - $rows[] = ['disabled users', $disabledUsersCount]; |
|
93 | + $disabledUsers = $this->config->getUsersForUserValue('core', 'enabled', 'false'); |
|
94 | + $disabledUsersCount = count($disabledUsers); |
|
95 | + $rows[] = ['disabled users', $disabledUsersCount]; |
|
96 | 96 | |
97 | - $table->setRows($rows); |
|
98 | - $table->render(); |
|
99 | - return 0; |
|
100 | - } |
|
97 | + $table->setRows($rows); |
|
98 | + $table->render(); |
|
99 | + return 0; |
|
100 | + } |
|
101 | 101 | |
102 | - private function countUsers(): array { |
|
103 | - return $this->userManager->countUsers(); |
|
104 | - } |
|
102 | + private function countUsers(): array { |
|
103 | + return $this->userManager->countUsers(); |
|
104 | + } |
|
105 | 105 | |
106 | - private function countUserDirectories(): int { |
|
107 | - $dataview = new View('/'); |
|
108 | - $userDirectories = $dataview->getDirectoryContent('/', 'httpd/unix-directory'); |
|
109 | - return count($userDirectories); |
|
110 | - } |
|
106 | + private function countUserDirectories(): int { |
|
107 | + $dataview = new View('/'); |
|
108 | + $userDirectories = $dataview->getDirectoryContent('/', 'httpd/unix-directory'); |
|
109 | + return count($userDirectories); |
|
110 | + } |
|
111 | 111 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | 'count-dirs', |
62 | 62 | null, |
63 | 63 | InputOption::VALUE_NONE, |
64 | - 'Also count the number of user directories in the database (could time out on huge installations, therefore defaults to no with ' . self::DEFAULT_COUNT_DIRS_MAX_USERS . '+ users)' |
|
64 | + 'Also count the number of user directories in the database (could time out on huge installations, therefore defaults to no with '.self::DEFAULT_COUNT_DIRS_MAX_USERS.'+ users)' |
|
65 | 65 | ) |
66 | 66 | ; |
67 | 67 | } |