@@ -66,8 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6666 }
6767
6868 $ kernel = $ this ->getContainer ()->get ('kernel ' );
69- $ output ->writeln ($ this ->getClearingCacheMessage ($ output , $ kernel ));
70-
69+ $ output ->writeln (sprintf ('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info> ' , $ kernel ->getEnvironment (), var_export ($ kernel ->isDebug (), true )));
7170 $ this ->getContainer ()->get ('cache_clearer ' )->clear ($ realCacheDir );
7271
7372 if ($ input ->getOption ('no-warmup ' )) {
@@ -78,55 +77,35 @@ protected function execute(InputInterface $input, OutputInterface $output)
7877 $ warmupDir = substr ($ realCacheDir , 0 , -1 ).'_ ' ;
7978
8079 if ($ filesystem ->exists ($ warmupDir )) {
81- $ this ->writelnIfVerbose ($ output , 'Clearing outdated warmup directory... ' );
80+ if ($ output ->isVerbose ()) {
81+ $ output ->writeln (' Clearing outdated warmup directory ' );
82+ }
8283 $ filesystem ->remove ($ warmupDir );
8384 }
8485
85- $ this ->writelnIfVerbose ($ output , 'Warming up cache... ' );
86+ if ($ output ->isVerbose ()) {
87+ $ output ->writeln (' Warming up cache ' );
88+ }
8689 $ this ->warmup ($ warmupDir , $ realCacheDir , !$ input ->getOption ('no-optional-warmers ' ));
8790
8891 $ filesystem ->rename ($ realCacheDir , $ oldCacheDir );
8992 if (defined ('PHP_WINDOWS_VERSION_BUILD ' )) {
9093 sleep (1 ); // workaround for Windows PHP rename bug
9194 }
9295 $ filesystem ->rename ($ warmupDir , $ realCacheDir );
93- $ this ->writelnIfVerbose ($ output , 'Warm up completed... ' );
9496 }
9597
96- $ this ->writelnIfVerbose ($ output , 'Removing old cache directory... ' );
97- $ filesystem ->remove ($ oldCacheDir );
98- $ this ->writelnIfVerbose ($ output , 'Completed clearing cache ' . ($ input ->getOption ('no-warmup ' ) ? "! " : " and warmup! " ));
99- }
98+ if ($ output ->isVerbose ()) {
99+ $ output ->writeln (' Removing old cache directory ' );
100+ }
100101
101- /**
102- * @param OutputInterface $output
103- * @param KernelInterface $kernel
104- * @return string
105- */
106- protected function getClearingCacheMessage (OutputInterface $ output , KernelInterface $ kernel ){
107- $ message = 'Clearing the cache for the <info>%s</info> environment with debug <info>%s</info> ' ;
108- $ message .= $ this ->isVerbose ($ output ) ? ": " : "" ;
109- return sprintf ($ message , $ kernel ->getEnvironment (), var_export ($ kernel ->isDebug (), true ));
110- }
102+ $ filesystem ->remove ($ oldCacheDir );
111103
112- /**
113- * @param OutputInterface $output
114- * @param string $message
115- */
116- protected function writelnIfVerbose (OutputInterface $ output , $ message ){
117- if ($ this ->isVerbose ($ output )){
118- $ output ->writeln ($ message );
104+ if ($ output ->isVerbose ()) {
105+ $ output ->writeln (' Done ' );
119106 }
120107 }
121108
122- /**
123- * @param OutputInterface $output
124- * @return bool
125- */
126- protected function isVerbose (OutputInterface $ output ){
127- return OutputInterface::VERBOSITY_VERBOSE <= $ output ->getVerbosity ();
128- }
129-
130109 /**
131110 * @param string $warmupDir
132111 * @param string $realCacheDir
0 commit comments