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

Commit 775ff1b

Browse files
committed
bug #269 #266 Self update is not detecting the installed version (Fabrice Baumann)
This PR was merged into the 1.0-dev branch. Discussion ---------- #266 Self update is not detecting the installed version When the self-update command is initialized, the current version and latest version of the installer are not initialized. The code is currently comparing NULL with NULL, which returns true. By adding the parent::initialize() call, the DownloadCommand set the current and latest version of the installer, and then the version_compare function is actually really comparing the real versions. Commits ------- 0640667 #266 Self update is not detecting the installed version
2 parents 7b09c99 + 0640667 commit 775ff1b

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/Symfony/Installer/DownloadCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ abstract class DownloadCommand extends Command
6565
/**
6666
* @var string The latest installer version
6767
*/
68-
private $latestInstallerVersion;
68+
protected $latestInstallerVersion;
6969

7070
/**
7171
* @var string The version of the local installer being executed
7272
*/
73-
private $localInstallerVersion;
73+
protected $localInstallerVersion;
7474

7575
/**
7676
* @var string The path to the downloaded file

src/Symfony/Installer/SelfUpdateCommand.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\Console\Input\InputInterface;
1515
use Symfony\Component\Console\Output\OutputInterface;
16-
use Symfony\Component\Filesystem\Filesystem;
1716
use Symfony\Component\Filesystem\Exception\IOException;
1817

1918
/**
@@ -33,11 +32,6 @@ class SelfUpdateCommand extends DownloadCommand
3332
*/
3433
private $tempDir;
3534

36-
/**
37-
* @var string The latest installer version
38-
*/
39-
private $latestInstallerVersion;
40-
4135
/**
4236
* @var string The URL where the latest installer version can be downloaded
4337
*/
@@ -92,10 +86,7 @@ public function isEnabled()
9286
*/
9387
protected function initialize(InputInterface $input, OutputInterface $output)
9488
{
95-
$this->fs = new Filesystem();
96-
$this->output = $output;
97-
98-
$this->latestInstallerVersion = $this->getUrlContents(Application::VERSIONS_URL);
89+
parent::initialize($input, $output);
9990
$this->remoteInstallerFile = 'http://symfony.com/installer';
10091
$this->currentInstallerFile = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
10192
$this->tempDir = sys_get_temp_dir();

0 commit comments

Comments
 (0)