Example #1
0
 /**
  * Single enable step that installs any included migrations
  *
  * @param mixed $old_state State returned by previous call of this method
  * @return false Indicates no further steps are required
  */
 public function enable_step($old_state)
 {
     $migrations = $this->get_migration_file_list();
     $this->migrator->set_migrations($migrations);
     $this->migrator->update();
     return !$this->migrator->finished();
 }
Example #2
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']);
 }