‪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 {
38  private ‪$installUtility;
39 
41  {
42  $this->installUtility = ‪$installUtility;
43  parent::__construct();
44  }
45 
49  public function ‪isEnabled()
50  {
52  }
53 
57  protected function ‪configure()
58  {
59  $this
60  ->setDescription('Deactivates an extension by extension key')
61  ->setAliases(['extensionmanager:extension:uninstall', 'extension:uninstall'])
62  ->addArgument(
63  'extensionkey',
64  InputArgument::REQUIRED,
65  'The extension key of a currently activated extension.'
66  );
67  }
68 
72  protected function ‪execute(InputInterface $input, OutputInterface ‪$output): int
73  {
74  $io = new SymfonyStyle($input, ‪$output);
75  $extensionKey = $input->getArgument('extensionkey');
76 
77  // @todo: Extbase BackendConfigurationManager triggered by repository calls needs a Request
78  $request = (new ServerRequest())->withAttribute('applicationType', ‪SystemEnvironmentBuilder::REQUESTTYPE_BE);
79  ‪$GLOBALS['TYPO3_REQUEST'] = $request;
80 
81  $this->installUtility->uninstall($extensionKey);
82 
83  $io->success('Deactivated extension "' . $extensionKey . '" successfully.');
84  return Command::SUCCESS;
85  }
86 }
‪TYPO3\CMS\Extensionmanager\Command\DeactivateExtensionCommand\configure
‪configure()
Definition: DeactivateExtensionCommand.php:56
‪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:48
‪TYPO3\CMS\Extensionmanager\Utility\InstallUtility
Definition: InstallUtility.php:55
‪TYPO3\CMS\Extensionmanager\Command
Definition: ActivateExtensionCommand.php:18
‪TYPO3\CMS\Extensionmanager\Command\DeactivateExtensionCommand\__construct
‪__construct(InstallUtility $installUtility)
Definition: DeactivateExtensionCommand.php:39
‪TYPO3\CMS\Core\Http\ServerRequest
Definition: ServerRequest.php:37
‪$output
‪$output
Definition: annotationChecker.php:119
‪$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\$installUtility
‪InstallUtility $installUtility
Definition: DeactivateExtensionCommand.php:37
‪TYPO3\CMS\Extensionmanager\Command\DeactivateExtensionCommand\execute
‪execute(InputInterface $input, OutputInterface $output)
Definition: DeactivateExtensionCommand.php:71