1
0
Fork 0

Make selfupdate use ssl when possible

pull/1590/head
Jordi Boggiano 2013-02-15 23:55:20 +01:00
parent d4fb7bd251
commit 2e12993c9c
1 changed files with 3 additions and 2 deletions

View File

@ -41,13 +41,14 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$protocol = extension_loaded('openssl') ? 'https' : 'http';
$rfs = new RemoteFilesystem($this->getIO()); $rfs = new RemoteFilesystem($this->getIO());
$latest = trim($rfs->getContents('getcomposer.org', 'http://getcomposer.org/version', false)); $latest = trim($rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/version', false));
if (Composer::VERSION !== $latest) { if (Composer::VERSION !== $latest) {
$output->writeln(sprintf("Updating to version <info>%s</info>.", $latest)); $output->writeln(sprintf("Updating to version <info>%s</info>.", $latest));
$remoteFilename = 'http://getcomposer.org/composer.phar'; $remoteFilename = $protocol . '://getcomposer.org/composer.phar';
$localFilename = $_SERVER['argv'][0]; $localFilename = $_SERVER['argv'][0];
$tempFilename = basename($localFilename, '.phar').'-temp.phar'; $tempFilename = basename($localFilename, '.phar').'-temp.phar';