16 use Symfony\Component\Console\Input\ArrayInput;
17 use Symfony\Component\Console\Input\InputInterface;
18 use Symfony\Component\Console\Input\InputOption;
19 use Symfony\Component\Console\Output\OutputInterface;
37 private $installerFactory;
42 private $deploymentConfig;
59 $this->installerFactory = $installerFactory;
62 parent::__construct();
72 self::INPUT_KEY_KEEP_GENERATED,
74 InputOption::VALUE_NONE,
75 'Prevents generated files from being deleted. ' . PHP_EOL .
76 'We discourage using this option except when deploying to production. ' . PHP_EOL .
77 'Consult your system integrator or administrator for more information.' 82 InputOption::VALUE_OPTIONAL,
83 'Allows to convert old scripts (InstallSchema, UpgradeSchema) to db_schema.xml format',
89 InputOption::VALUE_OPTIONAL,
90 'Safe installation of Magento with dumps on destructive operations, like column removal' 95 InputOption::VALUE_OPTIONAL,
96 'Restore removed data from dumps' 101 InputOption::VALUE_OPTIONAL,
102 'Magento Installation will be run in dry-run mode',
106 $this->setName(
'setup:upgrade')
107 ->setDescription(
'Upgrades the Magento application, DB data, and schema')
119 $keepGenerated = $input->getOption(self::INPUT_KEY_KEEP_GENERATED);
121 $installer->updateModulesSequence($keepGenerated);
125 if ($this->deploymentConfig->isAvailable()) {
127 $arrayInput =
new ArrayInput([]);
128 $arrayInput->setInteractive($input->isInteractive());
129 $importConfigCommand->run($arrayInput,
$output);
132 if (!$keepGenerated && $this->appState->getMode() === AppState::MODE_PRODUCTION) {
134 '<info>Please re-run Magento compile command. Use the command "setup:di:compile"</info>' 138 $output->writeln($e->getMessage());
139 return \Magento\Framework\Console\Cli::RETURN_FAILURE;
142 return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
const INPUT_KEY_KEEP_GENERATED
__construct(InstallerFactory $installerFactory, DeploymentConfig $deploymentConfig=null, AppState $appState=null)
execute(InputInterface $input, OutputInterface $output)
const INPUT_KEY_DRY_RUN_MODE
const CONVERT_OLD_SCRIPTS_KEY