setName('core:update');
$this->setDescription('Triggers upgrades. Use it after Piwik core or any plugin files have been updated.');
$this->addOption('dry-run', null, InputOption::VALUE_NONE, 'Only prints out the SQL requests that would be executed during the upgrade');
}
/**
* Execute command like: ./console core:update --dry-run
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$doDryRun = $input->getOption('dry-run');
try {
$this->makeUpdate($input, $output, $doDryRun);
} catch(NoUpdatesFoundException $e) {
// Do not fail if no updates were found
$output->writeln("".$e->getMessage()."");
} catch (\Exception $e) {
// Fail in case of any other error during upgrade
$output->writeln("" . $e->getMessage() . "");
throw $e;
}
}
protected function makeUpdate(InputInterface $input, OutputInterface $output, $doDryRun)
{
$this->checkAllRequiredOptionsAreNotEmpty($input);
$updateController = new Controller();
echo $updateController->runUpdaterAndExit($doDryRun);
}
}