From 9477e015bd89f02a007a42761b97c2c11b2078e1 Mon Sep 17 00:00:00 2001 From: Dimitrios Kanellopoulos Date: Sat, 16 Nov 2013 14:13:33 +0100 Subject: [PATCH] Use cache directory when downloading composer.phar Since there is a cache dir there is no need to populate the project directory with temp files. Plus the permissions on the project dir might not allow that. --- src/Composer/Command/SelfUpdateCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index d37598b04..86ecf1a8a 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -13,6 +13,7 @@ namespace Composer\Command; use Composer\Composer; +use Composer\Factory; use Composer\Util\RemoteFilesystem; use Composer\Downloader\FilesystemException; use Symfony\Component\Console\Input\InputInterface; @@ -42,8 +43,11 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { + $config = Factory::createConfig(); + $cacheDir = $config->get('cache-dir'); + $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0]; - $tempFilename = dirname($localFilename) . '/' . basename($localFilename, '.phar').'-temp.phar'; + $tempFilename = $cacheDir . basename($localFilename, '.phar').'-temp.phar'; // check for permissions in local filesystem before start connection process if (!is_writable($tempDirectory = dirname($tempFilename))) {