diff --git a/src/Composer/Command/ClearCacheCommand.php b/src/Composer/Command/ClearCacheCommand.php index f49b00bc3..47d139144 100644 --- a/src/Composer/Command/ClearCacheCommand.php +++ b/src/Composer/Command/ClearCacheCommand.php @@ -40,21 +40,30 @@ EOT { $config = Factory::createConfig(); $io = $this->getIO(); - - $cachePath = realpath($config->get('cache-repo-dir')); - if (!$cachePath) { - $io->write('Cache directory does not exist.'); - return; + + $cachePaths = array( + 'cache-dir' => $config->get('cache-dir'), + 'cache-files-dir' => $config->get('cache-files-dir'), + 'cache-repo-dir' => $config->get('cache-repo-dir'), + 'cache-vcs-dir' => $config->get('cache-vcs-dir'), + ); + + foreach ($cachePaths as $key => $cachePath) { + $cachePath = realpath($cachePath); + if (!$cachePath) { + $io->write("Cache directory does not exist ($key): $cachePath"); + return; + } + $cache = new Cache($io, $cachePath); + if (!$cache->isEnabled()) { + $io->write("Cache is not enabled ($key): $cachePath"); + return; + } + + $io->write("Clearing cache ($key): $cachePath"); + $cache->gc(0, 0); } - $cache = new Cache($io, $cachePath); - if (!$cache->isEnabled()) { - $io->write('Cache is not enabled.'); - return; - } - - $io->write('Clearing cache in: '.$cachePath.''); - $cache->gc(0, 0); - $io->write('Cache cleared.'); + $io->write('All caches cleared.'); } }