From be5eae58529c32405ea9d7cbe44d65d84bad0bd7 Mon Sep 17 00:00:00 2001 From: David Neilsen Date: Thu, 31 Jul 2014 10:55:59 +1200 Subject: [PATCH] Clear all the caches --- src/Composer/Command/ClearCacheCommand.php | 35 ++++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/Composer/Command/ClearCacheCommand.php b/src/Composer/Command/ClearCacheCommand.php index f49b00bc3..cf25491d3 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( + $config->get('cache-dir'), + $config->get('cache-files-dir'), + $config->get('cache-repo-dir'), + $config->get('cache-vcs-dir'), + ); + + foreach ($cachePaths as $cachePath) { + $cachePath = realpath($cachePath); + if (!$cachePath) { + $io->write('Cache directory does not exist.'); + return; + } + $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); } - $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.'); } }