Merge branch '2.0'
commit
d0b399b788
|
@ -425,7 +425,14 @@ TAGSPUBKEY
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (Platform::isWindows()) {
|
||||||
|
// use copy to apply permissions from the destination directory
|
||||||
|
// as rename uses source permissions and may block other users
|
||||||
|
copy($newFilename, $localFilename);
|
||||||
|
@unlink($newFilename);
|
||||||
|
} else {
|
||||||
rename($newFilename, $localFilename);
|
rename($newFilename, $localFilename);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -534,7 +541,7 @@ TAGSPUBKEY
|
||||||
/**
|
/**
|
||||||
* Invokes a UAC prompt to update composer.phar as an admin
|
* Invokes a UAC prompt to update composer.phar as an admin
|
||||||
*
|
*
|
||||||
* Uses a .vbs script to elevate and run the cmd.exe move command.
|
* Uses a .vbs script to elevate and run the cmd.exe copy command.
|
||||||
*
|
*
|
||||||
* @param string $localFilename The composer.phar location
|
* @param string $localFilename The composer.phar location
|
||||||
* @param string $newFilename The downloaded or backup phar
|
* @param string $newFilename The downloaded or backup phar
|
||||||
|
@ -560,13 +567,13 @@ TAGSPUBKEY
|
||||||
|
|
||||||
$checksum = hash_file('sha256', $newFilename);
|
$checksum = hash_file('sha256', $newFilename);
|
||||||
|
|
||||||
// cmd's internal move is fussy about backslashes
|
// cmd's internal copy is fussy about backslashes
|
||||||
$source = str_replace('/', '\\', $newFilename);
|
$source = str_replace('/', '\\', $newFilename);
|
||||||
$destination = str_replace('/', '\\', $localFilename);
|
$destination = str_replace('/', '\\', $localFilename);
|
||||||
|
|
||||||
$vbs = <<<EOT
|
$vbs = <<<EOT
|
||||||
Set UAC = CreateObject("Shell.Application")
|
Set UAC = CreateObject("Shell.Application")
|
||||||
UAC.ShellExecute "cmd.exe", "/c move /y ""$source"" ""$destination""", "", "runas", 0
|
UAC.ShellExecute "cmd.exe", "/c copy /b /y ""$source"" ""$destination""", "", "runas", 0
|
||||||
Wscript.Sleep(300)
|
Wscript.Sleep(300)
|
||||||
EOT;
|
EOT;
|
||||||
|
|
||||||
|
@ -574,11 +581,12 @@ EOT;
|
||||||
exec('"'.$script.'"');
|
exec('"'.$script.'"');
|
||||||
@unlink($script);
|
@unlink($script);
|
||||||
|
|
||||||
// see if the file was moved
|
// see if the file was moved and is still accessible
|
||||||
if ($result = (hash_file('sha256', $localFilename) === $checksum)) {
|
if ($result = is_readable($localFilename) && (hash_file('sha256', $localFilename) === $checksum)) {
|
||||||
$io->writeError('<info>Operation succeeded.</info>');
|
$io->writeError('<info>Operation succeeded.</info>');
|
||||||
|
@unlink($newFilename);
|
||||||
} else {
|
} else {
|
||||||
$io->writeError('<error>Operation failed (file not written). '.$helpMessage.'</error>');
|
$io->writeError('<error>Operation failed.'.$helpMessage.'</error>');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -519,7 +519,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
{
|
{
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
|
if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
|
||||||
throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
|
throw new \RuntimeException("Could not reset changes\n\n:".$output);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->hasDiscardedChanges[$path] = true;
|
$this->hasDiscardedChanges[$path] = true;
|
||||||
|
@ -533,7 +533,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
{
|
{
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
|
if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
|
||||||
throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
|
throw new \RuntimeException("Could not stash changes\n\n:".$output);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->hasStashedChanges[$path] = true;
|
$this->hasStashedChanges[$path] = true;
|
||||||
|
@ -547,7 +547,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
||||||
{
|
{
|
||||||
$path = $this->normalizePath($path);
|
$path = $this->normalizePath($path);
|
||||||
if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
|
if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
|
||||||
throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
|
throw new \RuntimeException("Could not view diff\n\n:".$output);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->io->writeError($output);
|
$this->io->writeError($output);
|
||||||
|
|
|
@ -183,7 +183,6 @@ class CurlDownloader
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url);
|
$options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url);
|
||||||
// Merge in headers - we don't get any proxy values
|
|
||||||
$options = StreamContextFactory::initOptions($url, $options, true);
|
$options = StreamContextFactory::initOptions($url, $options, true);
|
||||||
|
|
||||||
foreach (self::$options as $type => $curlOptions) {
|
foreach (self::$options as $type => $curlOptions) {
|
||||||
|
|
|
@ -131,12 +131,14 @@ class ProxyHelper
|
||||||
$error = sprintf('malformed %s url', $envName);
|
$error = sprintf('malformed %s url', $envName);
|
||||||
$proxy = parse_url($proxyUrl);
|
$proxy = parse_url($proxyUrl);
|
||||||
|
|
||||||
|
// We need parse_url to have identified a host
|
||||||
if (!isset($proxy['host'])) {
|
if (!isset($proxy['host'])) {
|
||||||
throw new \RuntimeException($error);
|
throw new \RuntimeException($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$proxyUrl = self::formatParsedUrl($proxy, true);
|
$proxyUrl = self::formatParsedUrl($proxy, true);
|
||||||
|
|
||||||
|
// We need a port because streams and curl use different defaults
|
||||||
if (!parse_url($proxyUrl, PHP_URL_PORT)) {
|
if (!parse_url($proxyUrl, PHP_URL_PORT)) {
|
||||||
throw new \RuntimeException($error);
|
throw new \RuntimeException($error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ class RemoteFilesystem
|
||||||
|
|
||||||
$ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
|
$ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
|
||||||
|
|
||||||
$proxy = ProxyManager::getInstance()->getProxyForRequest($fileUrl);
|
$proxy = $this->proxyManager->getProxyForRequest($fileUrl);
|
||||||
$usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
|
$usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
|
||||||
$this->io->writeError((strpos($origFileUrl, 'http') === 0 ? 'Downloading ' : 'Reading ') . Url::sanitize($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
|
$this->io->writeError((strpos($origFileUrl, 'http') === 0 ? 'Downloading ' : 'Reading ') . Url::sanitize($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
|
||||||
unset($origFileUrl, $proxy, $usingProxy);
|
unset($origFileUrl, $proxy, $usingProxy);
|
||||||
|
|
|
@ -78,7 +78,7 @@ class AllFunctionalTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$proc = new Process('php -dphar.readonly=0 '.escapeshellarg('./bin/compile'), $target);
|
$proc = new Process((defined('PHP_BINARY') ? escapeshellcmd(PHP_BINARY) : 'php').' -dphar.readonly=0 '.escapeshellarg('./bin/compile'), $target);
|
||||||
$exitcode = $proc->run();
|
$exitcode = $proc->run();
|
||||||
|
|
||||||
if ($exitcode !== 0 || trim($proc->getOutput())) {
|
if ($exitcode !== 0 || trim($proc->getOutput())) {
|
||||||
|
@ -110,7 +110,7 @@ class AllFunctionalTest extends TestCase
|
||||||
'COMPOSER_CACHE_DIR' => $this->testDir.'cache',
|
'COMPOSER_CACHE_DIR' => $this->testDir.'cache',
|
||||||
);
|
);
|
||||||
|
|
||||||
$cmd = 'php '.escapeshellarg(self::$pharPath).' --no-ansi '.$testData['RUN'];
|
$cmd = (defined('PHP_BINARY') ? escapeshellcmd(PHP_BINARY) : 'php') .' '.escapeshellarg(self::$pharPath).' --no-ansi '.$testData['RUN'];
|
||||||
$proc = new Process($cmd, $this->testDir, $env, null, 300);
|
$proc = new Process($cmd, $this->testDir, $env, null, 300);
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue