Example #1
0
 /**
  * @param InputInterface   $input
  * @param OutputInterface $output
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->getApplication()->setAutoExit(false);
     $this->detectContao($output);
     if (!$this->initContao()) {
         return false;
     }
     $withDrops = $input->getOption('with-drops');
     $installer = new \IMI\Contao\System\Installer();
     $installer->runUpdates($withDrops);
     $withoutRunonce = $input->getOption('skip-runonce');
     if (!$withoutRunonce) {
         $backend = new \IMI\Contao\System\Backend();
         $backend->runRunOnce();
     }
     $output->writeln('<info>done</info>');
     return 0;
 }
 /**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->detectContao($output);
     if (!$this->initContao()) {
         return;
     }
     $installer = new \IMI\Contao\System\Installer();
     $commands = $installer->getSql(!$input->getOption('skip-drops'));
     $backend = new \IMI\Contao\System\Backend();
     if (count($commands) > 0) {
         $this->writeSection($output, 'Planned SQL Updates');
         foreach ($commands as $key => $section) {
             foreach ($section as $command) {
                 if ($key == 'ALTER_DROP' || $key == 'DROP') {
                     $output->writeln('<fg=red>' . $command . '</fg=red>');
                 } else {
                     $output->writeln($command);
                 }
             }
         }
     } else {
         $this->writeSection($output, 'No SQL Updates Found', 'info');
     }
     if (!$input->getOption('skip-runonce')) {
         $runOnceList = $backend->listRunOnce();
         if (count($runOnceList) > 0) {
             $this->writeSection($output, 'Planned RunOnce Updates');
             foreach ($runOnceList as $runOnceFile) {
                 $output->writeln($runOnceFile);
             }
         } else {
             $this->writeSection($output, 'No RunOnce Updates Found', 'info');
         }
     }
     return;
 }