setDescription('Empty cache directories, clear Memcached, Redis if avalaible'); return $this; } public function execute(InputInterface $input, OutputInterface $output) { $files = $dirs = array(); $finder = new Finder(); $finder ->files() ->exclude('.git') ->exclude('.svn') ->in(array( dirname(__FILE__) . '/../../../../tmp/cache_minify/' , dirname(__FILE__) . '/../../../../tmp/cache_twig/' )) ; $count = 1; foreach ($finder as $file) { $files[$file->getPathname()] = $file->getPathname(); $count++; } $finder = new Finder(); $finder ->directories() ->in(array( dirname(__FILE__) . '/../../../../tmp/cache_minify' , dirname(__FILE__) . '/../../../../tmp/cache_twig' )) ->exclude('.git') ->exclude('.svn') ; foreach ($finder as $file) { $dirs[$file->getPathname()] = $file->getPathname(); printf('%4d) %s' . PHP_EOL, $count, $file->getPathname()); $count++; } foreach ($files as $file) { unlink($file); } foreach ($dirs as $dir) { rmdir($dir); } if(setup::is_installed()) { $registry = registry::get_instance(); $cache = cache_adapter::get_instance($registry); if($cache->ping()) { $cache->flush(); } } $output->write('Finished !', true); return; } }