From 5a528bcb5537d47c9dc0e31e61c86aad9d22c06c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 21 Mar 2011 09:39:28 +0100 Subject: [PATCH] [FrameworkBundle] change cache:clear warmup option to no-warmup as most of the time people will want to use the warmup version (especially in production env) --- .../Command/CacheClearCommand.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index b60e7dff65c2..e023b91a8db4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -19,6 +19,7 @@ * Clear and Warmup the cache. * * @author Francis Besset + * @author Fabien Potencier */ class CacheClearCommand extends CacheWarmupCommand { @@ -30,15 +31,13 @@ protected function configure() $this ->setName('cache:clear') ->setDefinition(array( - new InputOption('warmup', '', InputOption::VALUE_NONE, 'Warms up the cache') + new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Do not warm up the cache') )) ->setDescription('Clear the cache') ->setHelp(<<cache:clear command clear the cache. +The cache:clear command clears the application cache for the current environment: -./app/console cache:clear --warmup - -Warmup option, warms up the cache. +./app/console cache:clear EOF ) ; @@ -60,21 +59,16 @@ protected function execute(InputInterface $input, OutputInterface $output) $oldCacheDir = $realCacheDir.'_old'; if (!is_writable($realCacheDir)) { - throw new \RuntimeException(sprintf('Unable to write %s directory', $this->realCacheDir)); + throw new \RuntimeException(sprintf('Unable to write in "%s" directory', $this->realCacheDir)); } - if (!$input->getOption('warmup')) { - $output->writeln('Clear cache'); - + if ($input->getOption('no-warmup')) { rename($realCacheDir, $oldCacheDir); } else { parent::execute($input, $output); - $output->writeln('Move cache directories'); rename($realCacheDir, $oldCacheDir); rename($this->kernelTmp->getCacheDir(), $realCacheDir); - - $output->writeln('Clear the old cache'); } $this->container->get('filesystem')->remove($oldCacheDir);