From 08b29598c4f2d7b1a5addacf2797c1ab4e613011 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 28 Sep 2015 18:25:49 +0200 Subject: [PATCH 1/2] Updated the style for the "cache:clear" command --- .../Command/CacheClearCommand.php | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 6e85702cf678e..2fcb77298857a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -14,6 +14,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Finder\Finder; @@ -53,6 +54,9 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + $outputIsVerbose = $output->isVerbose(); + $output = new SymfonyStyle($input, $output); + $realCacheDir = $this->getContainer()->getParameter('kernel.cache_dir'); $oldCacheDir = $realCacheDir.'_old'; $filesystem = $this->getContainer()->get('filesystem'); @@ -66,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $kernel = $this->getContainer()->get('kernel'); - $output->writeln(sprintf('Clearing the cache for the %s environment with debug %s', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); + $output->comment(sprintf('Clearing the cache for the %s environment with debug %s', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); $this->getContainer()->get('cache_clearer')->clear($realCacheDir); if ($input->getOption('no-warmup')) { @@ -78,14 +82,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $warmupDir = substr($realCacheDir, 0, -1).'_'; if ($filesystem->exists($warmupDir)) { - if ($output->isVerbose()) { - $output->writeln(' Clearing outdated warmup directory'); + if ($outputIsVerbose) { + $output->comment('Clearing outdated warmup directory...'); } $filesystem->remove($warmupDir); } - if ($output->isVerbose()) { - $output->writeln(' Warming up cache'); + if ($outputIsVerbose) { + $output->comment('Warming up cache...'); } $this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers')); @@ -96,15 +100,17 @@ protected function execute(InputInterface $input, OutputInterface $output) $filesystem->rename($warmupDir, $realCacheDir); } - if ($output->isVerbose()) { - $output->writeln(' Removing old cache directory'); + if ($outputIsVerbose) { + $output->comment('Removing old cache directory...'); } $filesystem->remove($oldCacheDir); - if ($output->isVerbose()) { - $output->writeln(' Done'); + if ($outputIsVerbose) { + $output->comment('Finished'); } + + $output->success(sprintf('Cache for the "%s" environment (debug=%s) was succesfully cleared.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); } /** From 44c54160a58e6d61047a75461ca45fe5f84e8f98 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 28 Sep 2015 18:28:16 +0200 Subject: [PATCH 2/2] Updated the styles for the "cache:warmup" command --- .../Bundle/FrameworkBundle/Command/CacheWarmupCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php index 8e08153d4a964..186ea76c29d86 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php @@ -14,6 +14,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; /** * Warmup the cache. @@ -53,8 +54,10 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + $output = new SymfonyStyle($input, $output); + $kernel = $this->getContainer()->get('kernel'); - $output->writeln(sprintf('Warming up the cache for the %s environment with debug %s', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); + $output->comment(sprintf('Warming up the cache for the %s environment with debug %s', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); $warmer = $this->getContainer()->get('cache_warmer'); @@ -63,5 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $warmer->warmUp($this->getContainer()->getParameter('kernel.cache_dir')); + + $output->success(sprintf('Cache for the "%s" environment (debug=%s) was succesfully warmed.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy