1
0
Fork 0

Check if current dir is writable and if not try the cache dir from settings

pull/2428/head
Dimitrios Kanellopoulos 2013-11-16 18:52:44 +01:00
parent 9477e015bd
commit 95a9ac880b
1 changed files with 6 additions and 3 deletions

View File

@ -47,11 +47,14 @@ EOT
$cacheDir = $config->get('cache-dir');
$localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
$tempFilename = $cacheDir . basename($localFilename, '.phar').'-temp.phar';
// Check if current dir is writable and if not try the cache dir from settings
$tmpDir = is_writable(dirname($localFilename))? dirname($localFilename) . '/' : $cacheDir;
$tempFilename = $tmpDir . basename($localFilename, '.phar').'-temp.phar';
// check for permissions in local filesystem before start connection process
if (!is_writable($tempDirectory = dirname($tempFilename))) {
throw new FilesystemException('Composer update failed: the "'.$tempDirectory.'" directory used to download the temp file could not be written');
if (!is_writable($tmpDir)) {
throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
}
if (!is_writable($localFilename)) {