1
0
Fork 0

Update GitDownloader.php

PHP 5.3. compat.
pull/3297/head
Frederik Bosch 2014-09-24 15:24:28 +02:00
parent f3b0890cf4
commit 6edabc629d
1 changed files with 7 additions and 5 deletions

View File

@ -46,9 +46,10 @@ class GitDownloader extends VcsDownloader
$flag = defined('PHP_WINDOWS_VERSION_MAJOR') ? '/D ' : ''; $flag = defined('PHP_WINDOWS_VERSION_MAJOR') ? '/D ' : '';
$command = 'git clone --no-checkout %s %s && cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer'; $command = 'git clone --no-checkout %s %s && cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer';
$this->io->write(" Cloning ".$ref); $this->io->write(" Cloning ".$ref);
$commandCallable = function ($url) use ($ref, $path, $command) { $downloader = $this;
return sprintf($command, $this->shellEscapeUrl ($url), escapeshellarg($path), escapeshellarg($ref)); $commandCallable = function ($url) use ($ref, $path, $command, $downloader) {
return sprintf($command, $downloader->shellEscapeUrl ($url), escapeshellarg($path), escapeshellarg($ref));
}; };
$this->gitUtil->runCommand($commandCallable, $url, $path, true); $this->gitUtil->runCommand($commandCallable, $url, $path, true);
@ -94,8 +95,9 @@ class GitDownloader extends VcsDownloader
$this->io->write(" Checking out ".$ref); $this->io->write(" Checking out ".$ref);
$command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer'; $command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer';
$commandCallable = function ($url) use ($command) { $downloader = $this;
return sprintf($command, $this->shellEscapeUrl ($url)); $commandCallable = function ($url) use ($command, $downloader) {
return sprintf($command, $downloader->shellEscapeUrl ($url));
}; };
$this->gitUtil->runCommand($commandCallable, $url, $path); $this->gitUtil->runCommand($commandCallable, $url, $path);