protected function execute(InputInterface $input, OutputInterface $output)
{
$forceUpdate = true === $input->getOption('force-update');
if (!$forceUpdate && $this->isInstallerUpdated()) {
$this->output->writeln(sprintf('// Symfony Installer is <info>already updated</info> to the latest version (%s).', $this->latestInstallerVersion));
return;
}
$this->output->writeln(sprintf('// <info>updating</info> Symfony Installer to <info>%s</info> version', $this->latestInstallerVersion));
try {
$this->downloadNewVersion()->checkNewVersionIsValid()->backupCurrentVersion()->replaceCurrentVersionbyNewVersion()->cleanUp();
} catch (IOException $e) {
if ($this->output->isVeryVerbose()) {
$this->output->writeln($e->getMessage());
}
throw new \RuntimeException(sprintf("The installer couldn't be updated, probably because of a permissions issue.\n" . "Try to execute the command again with super user privileges:\n" . " sudo %s\n", $this->getExecutedCommand()));
} catch (\Exception $e) {
$this->rollback();
if ($this->output->isVeryVerbose()) {
$this->output->writeln($e->getMessage());
}
return 1;
}
}