Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| purge | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| configure | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 11 |
|
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\InputArgument; |
| 17 | use Symfony\Component\Console\Input\InputInterface; |
| 18 | use Symfony\Component\Console\Output\OutputInterface; |
| 19 | use Symfony\Component\Console\Style\SymfonyStyle; |
| 20 | |
| 21 | class purge extends command |
| 22 | { |
| 23 | /** |
| 24 | * {@inheritdoc} |
| 25 | */ |
| 26 | protected function configure() |
| 27 | { |
| 28 | $this |
| 29 | ->setName('extension:purge') |
| 30 | ->setDescription($this->user->lang('CLI_DESCRIPTION_PURGE_EXTENSION')) |
| 31 | ->addArgument( |
| 32 | 'extension-name', |
| 33 | InputArgument::REQUIRED, |
| 34 | $this->user->lang('CLI_EXTENSION_NAME') |
| 35 | ) |
| 36 | ; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Executes the command extension:purge. |
| 41 | * |
| 42 | * Purges the specified extension |
| 43 | * |
| 44 | * @param InputInterface $input An InputInterface instance |
| 45 | * @param OutputInterface $output An OutputInterface instance |
| 46 | * |
| 47 | * @return int |
| 48 | */ |
| 49 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 50 | { |
| 51 | $io = new SymfonyStyle($input, $output); |
| 52 | |
| 53 | $name = $input->getArgument('extension-name'); |
| 54 | $this->manager->purge($name); |
| 55 | $this->manager->load_extensions(); |
| 56 | |
| 57 | if ($this->manager->is_enabled($name)) |
| 58 | { |
| 59 | $io->error($this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name)); |
| 60 | return symfony_command::FAILURE; |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name)); |
| 65 | $this->check_apcu_cache($io); |
| 66 | $io->success($this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name)); |
| 67 | return symfony_command::SUCCESS; |
| 68 | } |
| 69 | } |
| 70 | } |