|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Gearman Bundle for Symfony2 / Symfony3 |
|
5
|
|
|
* |
|
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
7
|
|
|
* file that was distributed with this source code. |
|
8
|
|
|
* |
|
9
|
|
|
* Feel free to edit as you please, and have fun. |
|
10
|
|
|
* |
|
11
|
|
|
* @author Marc Morera <[email protected]> |
|
12
|
|
|
* @author Mickael Perraud <[email protected]> |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace Mkk\GearmanBundle\Command; |
|
16
|
|
|
|
|
17
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
18
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
19
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Warms up all cache data |
|
23
|
|
|
*/ |
|
24
|
|
|
class GearmanCacheWarmupCommand extends ContainerAwareCommand |
|
25
|
|
|
{ |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Console Command configuration |
|
29
|
|
|
*/ |
|
30
|
16 |
|
protected function configure() |
|
31
|
|
|
{ |
|
32
|
|
|
$this |
|
33
|
16 |
|
->setName('gearman:cache:warmup') |
|
34
|
16 |
|
->setAliases(array( |
|
35
|
|
|
'cache:gearman:warmup' |
|
36
|
16 |
|
)) |
|
37
|
16 |
|
->setDescription('Warms up gearman cache data'); |
|
38
|
16 |
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Executes the current command. |
|
42
|
|
|
* |
|
43
|
|
|
* @param InputInterface $input An InputInterface instance |
|
44
|
|
|
* @param OutputInterface $output An OutputInterface instance |
|
45
|
|
|
* |
|
46
|
|
|
* @return integer 0 if everything went fine, or an error code |
|
|
|
|
|
|
47
|
|
|
* |
|
48
|
|
|
* @throws \LogicException When this abstract class is not implemented |
|
49
|
|
|
*/ |
|
50
|
2 |
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
51
|
|
|
{ |
|
52
|
2 |
|
if (!$input->getOption('quiet')) { |
|
53
|
1 |
|
$environment = $this->getContainer()->getParameter('kernel.environment'); |
|
54
|
1 |
|
$output->writeln('Warming the cache for the ' . $environment . ' environment'); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
$this |
|
58
|
2 |
|
->getContainer() |
|
59
|
2 |
|
->get('gearman.cache.wrapper') |
|
60
|
2 |
|
->warmup(''); |
|
61
|
2 |
|
} |
|
62
|
|
|
} |
|
|
|
|
|
|
63
|
|
|
|
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.