Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Commit 14b6990

Browse files
committed
feature #272 Added an option to force the installer update (javiereguiluz)
This PR was merged into the 1.0-dev branch. Discussion ---------- Added an option to force the installer update In the past, I introduced several bugs that prevented to update the installer: first it was a server-side issue with version numbers ... and then it was a client-side issue while comparing versions (see #266). The only solution in those cases is to re-install the installer 😢 To avoid further issues, I propose to add a `--force-update (-f)` option that updates the local installer to whichever version is published by Symfony, without checking or comparing any version. Commits ------- 0c711da Added an option to force the installer update
2 parents 2b6beb6 + 0c711da commit 14b6990

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Symfony/Installer/SelfUpdateCommand.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Installer;
1313

1414
use Symfony\Component\Console\Input\InputInterface;
15+
use Symfony\Component\Console\Input\InputOption;
1516
use Symfony\Component\Console\Output\OutputInterface;
1617
use Symfony\Component\Filesystem\Exception\IOException;
1718

@@ -66,6 +67,7 @@ protected function configure()
6667
$this
6768
->setName('self-update')
6869
->setAliases(array('selfupdate'))
70+
->addOption('force-update', 'f', InputOption::VALUE_NONE, 'It updates the installer to the latest available version without checking if it\'s older or newer than the locally installed version.')
6971
->setDescription('Update the Symfony Installer to the latest version.')
7072
->setHelp('The <info>%command.name%</info> command updates the installer to the latest available version.')
7173
;
@@ -100,14 +102,15 @@ protected function initialize(InputInterface $input, OutputInterface $output)
100102
*/
101103
protected function execute(InputInterface $input, OutputInterface $output)
102104
{
103-
if ($this->isInstallerUpdated()) {
105+
$forceUpdate = true === $input->getOption('force-update');
106+
if (!$forceUpdate && $this->isInstallerUpdated()) {
104107
$this->output->writeln(sprintf('// Symfony Installer is <info>already updated</info> to the latest version (%s).', $this->latestInstallerVersion));
105108

106109
return;
107-
} else {
108-
$this->output->writeln(sprintf('// <info>updating</info> Symfony Installer to <info>%s</info> version', $this->latestInstallerVersion));
109110
}
110111

112+
$this->output->writeln(sprintf('// <info>updating</info> Symfony Installer to <info>%s</info> version', $this->latestInstallerVersion));
113+
111114
try {
112115
$this
113116
->downloadNewVersion()

0 commit comments

Comments
 (0)