Example #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $rc = 0;
     try {
         if (!$input->getOption('force')) {
             if (!$input->isInteractive()) {
                 throw new Exception("You have to specify the --force option in order to run this command");
             }
             $confirmQuestion = new ConfirmationQuestion('Are you sure you want to update this concrete5 installation?');
             if (!$this->getHelper('question')->ask($input, $output, $confirmQuestion)) {
                 throw new Exception("Operation aborted.");
             }
         }
         $configuration = new \Concrete\Core\Updater\Migrations\Configuration();
         $output = new ConsoleOutput();
         $configuration->setOutputWriter(new OutputWriter(function ($message) use($output) {
             $output->writeln($message);
         }));
         Update::updateToCurrentVersion($configuration);
     } catch (Exception $x) {
         $output->writeln('<error>' . $x->getMessage() . '</error>');
         $rc = 1;
     }
     return $rc;
 }