protected function execute(InputInterface $input, OutputInterface $output) { $config = Factory::createConfig(); $io = $this->getIO(); $cachePath = realpath($config->get('cache-repo-dir')); if (!$cachePath) { $io->write('<info>Cache directory does not exist.</info>'); return; } $cache = new Cache($io, $cachePath); if (!$cache->isEnabled()) { $io->write('<info>Cache is not enabled.</info>'); return; } $io->write('<info>Clearing cache in: ' . $cachePath . '</info>'); $cache->gc(0, 0); $io->write('<info>Cache cleared.</info>'); }
protected function execute(InputInterface $input, OutputInterface $output) { $config = Factory::createConfig(); $io = $this->getIO(); $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->writeError("<info>Cache directory does not exist ({$key}): {$cachePath}</info>"); continue; } $cache = new Cache($io, $cachePath); if (!$cache->isEnabled()) { $io->writeError("<info>Cache is not enabled ({$key}): {$cachePath}</info>"); continue; } $io->writeError("<info>Clearing cache ({$key}): {$cachePath}</info>"); $cache->gc(0, 0); } $io->writeError('<info>All caches cleared.</info>'); }