1
0
Fork 0

Clear all the caches

pull/3175/head
David Neilsen 2014-07-31 10:55:59 +12:00
parent 4ecdbf89c4
commit be5eae5852
1 changed files with 22 additions and 13 deletions

View File

@ -41,12 +41,19 @@ EOT
$config = Factory::createConfig(); $config = Factory::createConfig();
$io = $this->getIO(); $io = $this->getIO();
$cachePath = realpath($config->get('cache-repo-dir')); $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) { if (!$cachePath) {
$io->write('<info>Cache directory does not exist.</info>'); $io->write('<info>Cache directory does not exist.</info>');
return; return;
} }
$cache = new Cache($io, $cachePath); $cache = new Cache($io, $cachePath);
if (!$cache->isEnabled()) { if (!$cache->isEnabled()) {
$io->write('<info>Cache is not enabled.</info>'); $io->write('<info>Cache is not enabled.</info>');
@ -55,6 +62,8 @@ EOT
$io->write('<info>Clearing cache in: '.$cachePath.'</info>'); $io->write('<info>Clearing cache in: '.$cachePath.'</info>');
$cache->gc(0, 0); $cache->gc(0, 0);
}
$io->write('<info>Cache cleared.</info>'); $io->write('<info>Cache cleared.</info>');
} }
} }