Example #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->migrator->set_output_handler(new \src\db\log_wrapper_migrator_output_handler($this->user, new console_migrator_output_handler($this->user, $output), $this->src_root_path . 'store/migrations_' . time() . '.log'));
     $this->migrator->create_migrations_table();
     $this->cache->purge();
     $this->load_migrations();
     $orig_version = $this->config['version'];
     while (!$this->migrator->finished()) {
         try {
             $this->migrator->update();
         } catch (\src\db\migration\exception $e) {
             $output->writeln('<error>' . $e->getLocalisedMessage($this->user) . '</error>');
             $this->finalise_update();
             return 1;
         }
     }
     if ($orig_version != $this->config['version']) {
         $this->log->add('admin', ANONYMOUS, '', 'LOG_UPDATE_DATABASE', time(), array($orig_version, $this->config['version']));
     }
     $this->finalise_update();
     $output->writeln($this->user->lang['DATABASE_UPDATE_COMPLETE']);
 }