1
|
|
|
<?php |
2
|
|
|
/*************************************************************************** |
3
|
|
|
* For license information see doc/license.txt |
4
|
|
|
* |
5
|
|
|
* Unicode Reminder メモ |
6
|
|
|
***************************************************************************/ |
7
|
|
|
|
8
|
|
|
namespace AppBundle\Command; |
9
|
|
|
|
10
|
|
|
use Oc\Cache\WebCache; |
11
|
|
|
use Oc\Session\SessionDataCookie; |
12
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
13
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
14
|
|
|
|
15
|
|
|
class CreateWebCacheCommand extends AbstractCommand |
16
|
|
|
{ |
17
|
|
|
const COMMAND_NAME = 'cache:create-web-cache'; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @return void |
21
|
|
|
* @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
22
|
|
|
*/ |
23
|
|
|
protected function configure() |
24
|
|
|
{ |
25
|
|
|
parent::configure(); |
26
|
|
|
|
27
|
|
|
$this |
28
|
|
|
->setName(self::COMMAND_NAME) |
29
|
|
|
->setDescription('create legacy web caches'); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
34
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
35
|
|
|
* |
36
|
|
|
* @return int|null |
37
|
|
|
*/ |
38
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
39
|
|
|
{ |
40
|
|
|
$output->writeln('not complete implemented yet'); |
41
|
|
|
return self::CODE_ERROR; |
42
|
|
|
// TODO implement completely |
43
|
|
|
global $opt, $cookie; |
|
|
|
|
44
|
|
|
|
45
|
|
|
if (!isset($opt['rootpath'])) { |
46
|
|
|
$opt['rootpath'] = __DIR__ . '/../../../../htdocs/'; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
$cookie = new SessionDataCookie(); |
50
|
|
|
|
51
|
|
|
require_once __DIR__ . '/../../../lib2/cli.inc.php'; |
52
|
|
|
|
53
|
|
|
$webCache = new WebCache(); |
54
|
|
|
|
55
|
|
|
$output->writeln('Create menu cache file'); |
56
|
|
|
$webCache->createMenuCache(); |
57
|
|
|
|
58
|
|
|
$output->writeln('Create label cache file'); |
59
|
|
|
$webCache->createLabelCache(); |
60
|
|
|
|
61
|
|
|
$output->writeln('Precompiling template files'); |
62
|
|
|
$webCache->preCompileAllTemplates(); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.