Skip to content

Commit 79bea0a

Browse files
committed
feature #9966 added feedback to the cache:clear command (fabpot)
This PR was merged into the 2.5-dev branch. Discussion ---------- added feedback to the cache:clear command simplified version of #9463 | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #9463 | License | MIT | Doc PR | n/a "Especially in production it is sometimes critical to know exactly when your cache is cleared or warmed up. Currently cache:clear provides no feedback whats however. As sites get bigger, so become their cache files. Removing old cache files may sometimes even take minutes. Without any feedback from the cache:clear you do not know the current status. That's why i added more feedback to the cache:clear command that it makes it possible to see when your cache is warmed up and ready to go." Commits ------- f2261da [FrameworkBundle] simplified code a1f6411 [FrameworkBundle] added feedback in cache:clear
2 parents 0af3ca3 + f2261da commit 79bea0a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
7777
$warmupDir = substr($realCacheDir, 0, -1).'_';
7878

7979
if ($filesystem->exists($warmupDir)) {
80+
if ($output->isVerbose()) {
81+
$output->writeln(' Clearing outdated warmup directory');
82+
}
8083
$filesystem->remove($warmupDir);
8184
}
8285

86+
if ($output->isVerbose()) {
87+
$output->writeln(' Warming up cache');
88+
}
8389
$this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers'));
8490

8591
$filesystem->rename($realCacheDir, $oldCacheDir);
@@ -89,7 +95,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
8995
$filesystem->rename($warmupDir, $realCacheDir);
9096
}
9197

98+
if ($output->isVerbose()) {
99+
$output->writeln(' Removing old cache directory');
100+
}
101+
92102
$filesystem->remove($oldCacheDir);
103+
104+
if ($output->isVerbose()) {
105+
$output->writeln(' Done');
106+
}
93107
}
94108

95109
/**

0 commit comments

Comments
 (0)