‪TYPO3CMS  ‪main
DeactivateExtensionCommand.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Symfony\Component\Console\Command\Command;
21 use Symfony\Component\Console\Input\InputArgument;
22 use Symfony\Component\Console\Input\InputInterface;
23 use Symfony\Component\Console\Output\OutputInterface;
24 use Symfony\Component\Console\Style\SymfonyStyle;
29 
33 class ‪DeactivateExtensionCommand extends Command
34 {
35  public function ‪__construct(private readonly ‪InstallUtility $installUtility)
36  {
37  parent::__construct();
38  }
39 
43  public function ‪isEnabled(): bool
44  {
46  }
47 
51  protected function ‪configure()
52  {
53  $this
54  ->setDescription('Deactivates an extension by extension key')
55  ->setAliases(['extensionmanager:extension:uninstall', 'extension:uninstall'])
56  ->addArgument(
57  'extensionkey',
58  InputArgument::REQUIRED,
59  'The extension key of a currently activated extension.'
60  );
61  }
62 
66  protected function ‪execute(InputInterface $input, OutputInterface ‪$output): int
67  {
68  $io = new SymfonyStyle($input, ‪$output);
69  $extensionKey = $input->getArgument('extensionkey');
70 
71  // @todo: Extbase BackendConfigurationManager triggered by repository calls needs a Request
72  $request = (new ‪ServerRequest())->withAttribute('applicationType', ‪SystemEnvironmentBuilder::REQUESTTYPE_BE);
73  ‪$GLOBALS['TYPO3_REQUEST'] = $request;
74 
75  $this->installUtility->uninstall($extensionKey);
76 
77  $io->success('Deactivated extension "' . $extensionKey . '" successfully.');
78  return Command::SUCCESS;
79  }
80 }
‪TYPO3\CMS\Extensionmanager\Command\DeactivateExtensionCommand\configure
‪configure()
Definition: DeactivateExtensionCommand.php:51
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder
Definition: SystemEnvironmentBuilder.php:41
‪TYPO3\CMS\Extensionmanager\Command\DeactivateExtensionCommand
Definition: DeactivateExtensionCommand.php:34
‪TYPO3\CMS\Core\Core\Environment\isComposerMode
‪static isComposerMode()
Definition: Environment.php:137
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder\REQUESTTYPE_BE
‪const REQUESTTYPE_BE
Definition: SystemEnvironmentBuilder.php:45
‪TYPO3\CMS\Extensionmanager\Command\DeactivateExtensionCommand\isEnabled
‪isEnabled()
Definition: DeactivateExtensionCommand.php:43
‪TYPO3\CMS\Extensionmanager\Utility\InstallUtility
Definition: InstallUtility.php:40
‪TYPO3\CMS\Extensionmanager\Command
Definition: ActivateExtensionCommand.php:18
‪TYPO3\CMS\Core\Http\ServerRequest
Definition: ServerRequest.php:39
‪$output
‪$output
Definition: annotationChecker.php:114
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41
‪TYPO3\CMS\Extensionmanager\Command\DeactivateExtensionCommand\__construct
‪__construct(private readonly InstallUtility $installUtility)
Definition: DeactivateExtensionCommand.php:35
‪TYPO3\CMS\Extensionmanager\Command\DeactivateExtensionCommand\execute
‪execute(InputInterface $input, OutputInterface $output)
Definition: DeactivateExtensionCommand.php:66