From 3c5f3e6dc7e953ccf44d78a88044c317d6b9e04e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 14 Aug 2015 13:30:42 +0100 Subject: [PATCH] Warn if cache isnt writable as well --- src/Composer/Cache.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Composer/Cache.php b/src/Composer/Cache.php index 22e744fd2..9f9c55ba6 100644 --- a/src/Composer/Cache.php +++ b/src/Composer/Cache.php @@ -43,11 +43,12 @@ class Cache $this->whitelist = $whitelist; $this->filesystem = $filesystem ?: new Filesystem(); - if (!is_dir($this->root)) { - if (!@mkdir($this->root, 0777, true)) { - $this->io->writeError('Cannot create cache directory ' . $this->root . ', proceeding without cache'); - $this->enabled = false; - } + if ( + (!is_dir($this->root) && !@mkdir($this->root, 0777, true)) + || !is_writable($this->root) + ) { + $this->io->writeError('Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache'); + $this->enabled = false; } }