Skip to content

Commit 587f2b6

Browse files
Merge branch '5.1' into 5.2
* 5.1: [Uid] fix checking for valid UUIDs [HttpKernel] Configure the ErrorHandler even when it is overriden Allow relative path to composer cache
2 parents 45b8e0a + 057e963 commit 587f2b6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bin/simple-phpunit.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@
164164
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
165165
: 'composer';
166166

167+
$prevCacheDir = getenv('COMPOSER_CACHE_DIR');
168+
if ($prevCacheDir) {
169+
if (false === $absoluteCacheDir = realpath($prevCacheDir)) {
170+
@mkdir($prevCacheDir, 0777, true);
171+
$absoluteCacheDir = realpath($prevCacheDir);
172+
}
173+
if ($absoluteCacheDir) {
174+
putenv("COMPOSER_CACHE_DIR=$absoluteCacheDir");
175+
} else {
176+
$prevCacheDir = false;
177+
}
178+
}
167179
$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml' : ''));
168180
$configurationHash = md5(implode(\PHP_EOL, [md5_file(__FILE__), $SYMFONY_PHPUNIT_REMOVE, (int) $PHPUNIT_REMOVE_RETURN_TYPEHINT]));
169181
$PHPUNIT_VERSION_DIR = sprintf('phpunit-%s-%d', $PHPUNIT_VERSION, $PHPUNIT_REMOVE_RETURN_TYPEHINT);
@@ -246,6 +258,9 @@
246258
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
247259
$exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress $q", [], $p, getcwd()));
248260
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
261+
if ($prevCacheDir) {
262+
putenv("COMPOSER_CACHE_DIR=$prevCacheDir");
263+
}
249264
if ($exit) {
250265
exit($exit);
251266
}

0 commit comments

Comments
 (0)