@@ -66,8 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
66
66
}
67
67
68
68
$ 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 )));
71
70
$ this ->getContainer ()->get ('cache_clearer ' )->clear ($ realCacheDir );
72
71
73
72
if ($ input ->getOption ('no-warmup ' )) {
@@ -78,55 +77,35 @@ protected function execute(InputInterface $input, OutputInterface $output)
78
77
$ warmupDir = substr ($ realCacheDir , 0 , -1 ).'_ ' ;
79
78
80
79
if ($ filesystem ->exists ($ warmupDir )) {
81
- $ this ->writelnIfVerbose ($ output , 'Clearing outdated warmup directory... ' );
80
+ if ($ output ->isVerbose ()) {
81
+ $ output ->writeln (' Clearing outdated warmup directory ' );
82
+ }
82
83
$ filesystem ->remove ($ warmupDir );
83
84
}
84
85
85
- $ this ->writelnIfVerbose ($ output , 'Warming up cache... ' );
86
+ if ($ output ->isVerbose ()) {
87
+ $ output ->writeln (' Warming up cache ' );
88
+ }
86
89
$ this ->warmup ($ warmupDir , $ realCacheDir , !$ input ->getOption ('no-optional-warmers ' ));
87
90
88
91
$ filesystem ->rename ($ realCacheDir , $ oldCacheDir );
89
92
if (defined ('PHP_WINDOWS_VERSION_BUILD ' )) {
90
93
sleep (1 ); // workaround for Windows PHP rename bug
91
94
}
92
95
$ filesystem ->rename ($ warmupDir , $ realCacheDir );
93
- $ this ->writelnIfVerbose ($ output , 'Warm up completed... ' );
94
96
}
95
97
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
+ }
100
101
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 );
111
103
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 ' );
119
106
}
120
107
}
121
108
122
- /**
123
- * @param OutputInterface $output
124
- * @return bool
125
- */
126
- protected function isVerbose (OutputInterface $ output ){
127
- return OutputInterface::VERBOSITY_VERBOSE <= $ output ->getVerbosity ();
128
- }
129
-
130
109
/**
131
110
* @param string $warmupDir
132
111
* @param string $realCacheDir
0 commit comments