Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UninstallCommand.php
Go to the documentation of this file.
1 <?php
8 
9 use Symfony\Component\Console\Input\InputInterface;
10 use Symfony\Component\Console\Output\OutputInterface;
11 use Symfony\Component\Console\Question\ConfirmationQuestion;
14 
16 {
20  private $installerFactory;
21 
25  public function __construct(InstallerFactory $installerFactory)
26  {
27  $this->installerFactory = $installerFactory;
28  parent::__construct();
29  }
30 
34  protected function configure()
35  {
36  $this->setName('setup:uninstall')
37  ->setDescription('Uninstalls the Magento application');
38  parent::configure();
39  }
40 
44  protected function execute(InputInterface $input, OutputInterface $output)
45  {
46  $helper = $this->getHelper('question');
47  $question = new ConfirmationQuestion('Are you sure you want to uninstall Magento?[y/N]', false);
48 
49  if ($helper->ask($input, $output, $question) || !$input->isInteractive()) {
50  $installer = $this->installerFactory->create(new ConsoleLogger($output));
51  $installer->uninstall();
52  }
53  return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
54  }
55 }
$helper
Definition: iframe.phtml:13
__construct(InstallerFactory $installerFactory)
execute(InputInterface $input, OutputInterface $output)