Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
show | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
configure | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
execute | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | /** |
3 | * |
4 | * This file is part of the phpBB Forum Software package. |
5 | * |
6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
8 | * |
9 | * For full copyright and license information, please see |
10 | * the docs/CREDITS.txt file. |
11 | * |
12 | */ |
13 | namespace phpbb\console\command\extension; |
14 | |
15 | use Symfony\Component\Console\Command\Command as symfony_command; |
16 | use Symfony\Component\Console\Input\InputInterface; |
17 | use Symfony\Component\Console\Output\OutputInterface; |
18 | use Symfony\Component\Console\Style\SymfonyStyle; |
19 | |
20 | class show extends command |
21 | { |
22 | /** |
23 | * {@inheritdoc} |
24 | */ |
25 | protected function configure() |
26 | { |
27 | $this |
28 | ->setName('extension:show') |
29 | ->setDescription($this->user->lang('CLI_DESCRIPTION_LIST_EXTENSIONS')) |
30 | ; |
31 | } |
32 | |
33 | /** |
34 | * Executes the command extension:show. |
35 | * |
36 | * Lists all extensions in the database and on the filesystem |
37 | * |
38 | * @param InputInterface $input An InputInterface instance |
39 | * @param OutputInterface $output An OutputInterface instance |
40 | * |
41 | * @return int |
42 | */ |
43 | protected function execute(InputInterface $input, OutputInterface $output) |
44 | { |
45 | $io = new SymfonyStyle($input, $output); |
46 | |
47 | $this->manager->load_extensions(); |
48 | $all = array_keys($this->manager->all_available()); |
49 | |
50 | if (empty($all)) |
51 | { |
52 | $io->note($this->user->lang('CLI_EXTENSION_NOT_FOUND')); |
53 | return symfony_command::FAILURE; |
54 | } |
55 | |
56 | $enabled = array_keys($this->manager->all_enabled()); |
57 | $io->section($this->user->lang('CLI_EXTENSIONS_ENABLED')); |
58 | $io->listing($enabled); |
59 | |
60 | $disabled = array_keys($this->manager->all_disabled()); |
61 | $io->section($this->user->lang('CLI_EXTENSIONS_DISABLED')); |
62 | $io->listing($disabled); |
63 | |
64 | $purged = array_diff($all, $enabled, $disabled); |
65 | $io->section($this->user->lang('CLI_EXTENSIONS_AVAILABLE')); |
66 | $io->listing($purged); |
67 | |
68 | return symfony_command::SUCCESS; |
69 | } |
70 | } |