/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->comment("Clearing the cache (<info>{$this->cacheDir}</info>)"); $this->cacheClearer->clear($this->cacheDir); $io->success('Cache cleared'); }
private function cacheClear(OutputInterface $output) { if (!is_writable($this->cacheDir)) { throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $this->cacheDir)); } $output->writeln(sprintf('Clearing cache for directory <info>%s</info>', $this->cacheDir)); $this->cacheClearer->clear($this->cacheDir); }
private function cacheClear(OutputInterface $output) { if (!is_writable($this->cacheDir)) { throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $this->cacheDir)); } $output->writeln(sprintf('Clearing cache for directory <info>%s</info>', $this->cacheDir)); $oldCacheDir = $this->cacheDir . '_old'; if ($this->filesystem->exists($oldCacheDir)) { $this->filesystem->remove($oldCacheDir); } $this->cacheClearer->clear($this->cacheDir); $this->filesystem->rename($this->cacheDir, $oldCacheDir); $this->filesystem->remove($oldCacheDir); }