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

Commit 0c711da

Browse files
committed
Added an option to force the installer update
1 parent 775ff1b commit 0c711da

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)