equal
deleted
inserted
replaced
|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony package. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
7 * |
|
8 * For the full copyright and license information, please view the LICENSE |
|
9 * file that was distributed with this source code. |
|
10 */ |
|
11 |
|
12 namespace Symfony\Bundle\FrameworkBundle\Command; |
|
13 |
|
14 use Symfony\Component\Console\Input\InputInterface; |
|
15 use Symfony\Component\Console\Output\OutputInterface; |
|
16 |
|
17 /** |
|
18 * Warmup the cache. |
|
19 * |
|
20 * @author Fabien Potencier <fabien@symfony.com> |
|
21 */ |
|
22 class CacheWarmupCommand extends ContainerAwareCommand |
|
23 { |
|
24 /** |
|
25 * @see Command |
|
26 */ |
|
27 protected function configure() |
|
28 { |
|
29 $this |
|
30 ->setName('cache:warmup') |
|
31 ->setDescription('Warms up an empty cache') |
|
32 ->setHelp(<<<EOF |
|
33 The <info>cache:warmup</info> command warms up the cache. |
|
34 |
|
35 Before running this command, the cache must be empty. |
|
36 EOF |
|
37 ) |
|
38 ; |
|
39 } |
|
40 |
|
41 /** |
|
42 * {@inheritdoc} |
|
43 */ |
|
44 protected function execute(InputInterface $input, OutputInterface $output) |
|
45 { |
|
46 $output->writeln('Warming up the cache'); |
|
47 |
|
48 $warmer = $this->getContainer()->get('cache_warmer'); |
|
49 $warmer->enableOptionalWarmers(); |
|
50 $warmer->warmUp($this->getContainer()->getParameter('kernel.cache_dir')); |
|
51 } |
|
52 } |