/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $this->inputOptionProvider = new InputOptionProvider($output, $input, $this->getHelperSet()->get('dialog')); if (false === $input->isInteractive()) { $this->validate($input); } $forceInstall = $input->getOption('force'); $commandExecutor = new CommandExecutor($input->hasOption('env') ? $input->getOption('env') : null, $output, $this->getApplication(), $this->getContainer()->get('oro_cache.oro_data_cache_manager')); $commandExecutor->setDefaultTimeout($input->getOption('timeout')); // if there is application is not installed or no --force option $isInstalled = $this->getContainer()->hasParameter('installed') && $this->getContainer()->getParameter('installed'); if ($isInstalled && !$forceInstall) { $output->writeln('<comment>ATTENTION</comment>: Oro Application already installed.'); $output->writeln('To proceed with install - run command with <info>--force</info> option:'); $output->writeln(sprintf(' <info>%s --force</info>', $this->getName())); $output->writeln('To reinstall over existing database - run command with <info>--force --drop-database</info> options:'); $output->writeln(sprintf(' <info>%s --force --drop-database</info>', $this->getName())); $output->writeln('<comment>ATTENTION</comment>: All data will be lost. ' . 'Database backup is highly recommended before executing this command.'); $output->writeln(''); return; } if ($forceInstall) { // if --force option we have to clear cache and set installed to false $this->updateInstalledFlag(false); $commandExecutor->runCommand('cache:clear', array('--no-optional-warmers' => true, '--process-isolation' => true)); } $output->writeln('<info>Installing Oro Application.</info>'); $output->writeln(''); $this->checkStep($output)->prepareStep($commandExecutor, $input->getOption('drop-database'))->loadDataStep($commandExecutor, $output)->finalStep($commandExecutor, $output, $input); $output->writeln(''); $output->writeln(sprintf('<info>Oro Application has been successfully installed in <comment>%s</comment> mode.</info>', $input->getOption('env'))); if ('prod' != $input->getOption('env')) { $output->writeln('<info>To run application in <comment>prod</comment> mode, ' . 'please run <comment>cache:clear</comment> command with <comment>--env prod</comment> parameter</info>'); } }
/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $force = $input->getOption('force'); if ($force) { $assetsOptions = array('--exclude' => array('OroInstallerBundle')); if ($input->hasOption('symlink') && $input->getOption('symlink')) { $assetsOptions['--symlink'] = true; } $commandExecutor = new CommandExecutor($input->hasOption('env') ? $input->getOption('env') : null, $output, $this->getApplication(), $this->getContainer()->get('oro_cache.oro_data_cache_manager')); $commandExecutor->setDefaultTimeout($input->getOption('timeout')); $commandExecutor->runCommand('oro:migration:load', array('--process-isolation' => true, '--force' => true))->runCommand('oro:workflow:definitions:load', array('--process-isolation' => true))->runCommand('oro:process:configuration:load', array('--process-isolation' => true))->runCommand('oro:migration:data:load', array('--process-isolation' => true))->runCommand('oro:navigation:init', array('--process-isolation' => true))->runCommand('oro:assets:install', $assetsOptions)->runCommand('assetic:dump')->runCommand('fos:js-routing:dump', array('--target' => 'web/js/routes.js'))->runCommand('oro:localization:dump')->runCommand('oro:translation:dump')->runCommand('oro:requirejs:build', array('--ignore-errors' => true)); } else { $output->writeln('<comment>ATTENTION</comment>: Database backup is highly recommended before executing this command.'); $output->writeln(' Please make sure that application cache is up-to-date before run this command.'); $output->writeln(' Use <info>cache:clear</info> if needed.'); $output->writeln(''); $output->writeln('To force execution run command with <info>--force</info> option:'); $output->writeln(sprintf(' <info>%s --force</info>', $this->getName())); } }