-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Feedback in cache:clear #9463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback in cache:clear #9463
Changes from 1 commit
2e0b665
1927a32
5a0da38
1a0941c
7fada16
d1895f8
f36bf45
File filter
Filter by extension
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,8 @@ protected function execute(InputInterface $input, OutputInterface $output) | |
} | ||
|
||
$kernel = $this->getContainer()->get('kernel'); | ||
$output->writeln(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>:', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); | ||
$output->writeln($this->getClearingCacheMessage($output, $kernel)); | ||
|
||
$this->getContainer()->get('cache_clearer')->clear($realCacheDir); | ||
|
||
if ($input->getOption('no-warmup')) { | ||
|
@@ -77,24 +78,53 @@ protected function execute(InputInterface $input, OutputInterface $output) | |
$warmupDir = substr($realCacheDir, 0, -1).'_'; | ||
|
||
if ($filesystem->exists($warmupDir)) { | ||
$output->writeln('Clearing outdated warmup directory...'); | ||
$this->writelnIfVerbose($output, 'Clearing outdated warmup directory...'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leave a space after directory There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope |
||
$filesystem->remove($warmupDir); | ||
} | ||
|
||
$output->writeln('Warming up cache...'); | ||
$this->writelnIfVerbose($output, 'Warming up cache...'); | ||
$this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers')); | ||
|
||
$filesystem->rename($realCacheDir, $oldCacheDir); | ||
if (defined('PHP_WINDOWS_VERSION_BUILD')) { | ||
sleep(1); // workaround for windows php rename bug | ||
} | ||
$filesystem->rename($warmupDir, $realCacheDir); | ||
$output->writeln('Warm up completed...'); | ||
$this->writelnIfVerbose($output, 'Warm up completed...'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need to remove the 3 dots. |
||
} | ||
|
||
$output->writeln('Removing old cache directory...'); | ||
$this->writelnIfVerbose($output, 'Removing old cache directory...'); | ||
$filesystem->remove($oldCacheDir); | ||
$output->writeln('Completed clearing cache' . ($input->getOption('no-warmup') ? "!" : " and warmup!")); | ||
$this->writelnIfVerbose($output, 'Completed clearing cache' . ($input->getOption('no-warmup') ? "!" : " and warmup!")); | ||
} | ||
|
||
/** | ||
* @param OutputInterface $output | ||
* @param KernelInterface $kernel | ||
* @return string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a new line before |
||
*/ | ||
protected function getClearingCacheMessage(OutputInterface $output, KernelInterface $kernel){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cs = space between ) and { There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct |
||
$message = 'Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to define a seperate |
||
$message .= $this->isVerbose($output) ? ":" : ""; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leave a space before the return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. include this in the sprintf |
||
return sprintf($message, $kernel->getEnvironment(), var_export($kernel->isDebug(), true)); | ||
} | ||
|
||
/** | ||
* @param OutputInterface $output | ||
* @param string $message | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sure |
||
*/ | ||
protected function writelnIfVerbose(OutputInterface $output, $message){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. run phpcs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space between ) and { |
||
if ($this->isVerbose($output)){ | ||
$output->writeln($message); | ||
} | ||
} | ||
|
||
/** | ||
* @param OutputInterface $output | ||
* @return bool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Boolean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line here too |
||
*/ | ||
protected function isVerbose(OutputInterface $output){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
return OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity(); | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you move it to a method?