. */ /* */ /*************************************************************************************/ namespace Thelia\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Exception\IOException; class ClearCacheCommand extends Command { protected function configure() { $this ->setName("clear:cache") ->setDescription("Invalidate all caches"); } protected function execute(InputInterface $input, OutputInterface $output) { $cacheDir = $this->getApplication()->getContainer()->getParameter("kernel.cache_dir"); if (!is_writable($cacheDir)) { throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $cacheDir)); } $fs = new Filesystem(); $fs->remove($this->getApplication()->getKernel()->getContainer()->getParameter("kernel.cache_dir")); } }