|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Zikula package. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright Zikula Foundation - http://zikula.org/ |
|
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
|
|
|
use Zikula\Bundle\CoreBundle\DynamicConfigDumper; |
|
13
|
|
|
use Zikula\Bundle\CoreBundle\HttpKernel\ZikulaKernel as Kernel; |
|
14
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
|
15
|
|
|
|
|
16
|
|
|
class ZikulaKernel extends Kernel |
|
17
|
|
|
{ |
|
18
|
|
|
public function registerBundles() |
|
19
|
|
|
{ |
|
20
|
|
|
$bundles = [ |
|
21
|
|
|
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
|
22
|
|
|
new Symfony\Bundle\SecurityBundle\SecurityBundle(), |
|
23
|
|
|
new Symfony\Bundle\TwigBundle\TwigBundle(), |
|
24
|
|
|
new Symfony\Bundle\MonologBundle\MonologBundle(), |
|
25
|
|
|
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), |
|
26
|
|
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), |
|
27
|
|
|
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), |
|
28
|
|
|
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), |
|
29
|
|
|
new Zikula\Bundle\CoreBundle\CoreBundle(), |
|
30
|
|
|
new Zikula\Bundle\CoreInstallerBundle\ZikulaCoreInstallerBundle(), |
|
31
|
|
|
new Zikula\Bundle\FormExtensionBundle\ZikulaFormExtensionBundle(), |
|
32
|
|
|
new Zikula\Bundle\HookBundle\ZikulaHookBundle(), |
|
33
|
|
|
new Zikula\Bundle\JQueryBundle\ZikulaJQueryBundle(), |
|
34
|
|
|
new Zikula\Bundle\JQueryUIBundle\ZikulaJQueryUIBundle(), |
|
35
|
|
|
new JMS\I18nRoutingBundle\JMSI18nRoutingBundle(), |
|
36
|
|
|
new JMS\TranslationBundle\JMSTranslationBundle(), |
|
37
|
|
|
new FOS\JsRoutingBundle\FOSJsRoutingBundle(), |
|
38
|
|
|
new Matthias\SymfonyConsoleForm\Bundle\SymfonyConsoleFormBundle(), |
|
39
|
|
|
new Knp\Bundle\MenuBundle\KnpMenuBundle(), |
|
40
|
|
|
new Liip\ImagineBundle\LiipImagineBundle(), |
|
41
|
|
|
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(), |
|
42
|
|
|
new Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle(), |
|
43
|
|
|
new Zikula\Bundle\WorkflowBundle\ZikulaWorkflowBundle(), |
|
44
|
|
|
]; |
|
45
|
|
|
|
|
46
|
|
|
foreach (self::$coreModules as $bundleClass) { |
|
47
|
|
|
$bundles[] = new $bundleClass(); |
|
48
|
|
|
} |
|
49
|
|
|
$boot = new \Zikula\Bundle\CoreBundle\Bundle\Bootstrap(); |
|
50
|
|
|
$boot->getPersistedBundles($this, $bundles); |
|
51
|
|
|
|
|
52
|
|
|
if (in_array($this->getEnvironment(), ['dev', 'test'])) { |
|
53
|
|
|
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); |
|
54
|
|
|
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); |
|
55
|
|
|
$bundles[] = new Elao\WebProfilerExtraBundle\WebProfilerExtraBundle(); |
|
56
|
|
|
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); |
|
57
|
|
|
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); |
|
58
|
|
|
// $bundles[] = new Zikula\Bundle\GeneratorBundle\ZikulaGeneratorBundle(); |
|
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
return $bundles; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
|
65
|
|
|
{ |
|
66
|
|
|
$loader->load($this->rootDir.'/config/config_'.$this->getEnvironment().'.yml'); |
|
67
|
|
|
$loader->load($this->rootDir.'/config/parameters.yml'); |
|
68
|
|
|
if (is_readable($this->rootDir.'/config/custom_parameters.yml')) { |
|
69
|
|
|
$loader->load($this->rootDir.'/config/custom_parameters.yml'); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
if (!is_readable($this->rootDir . '/config/' . DynamicConfigDumper::CONFIG_GENERATED)) { |
|
73
|
|
|
// There is no generated configuration (yet), load default values. |
|
74
|
|
|
// This only happens at the very first time Symfony is started. |
|
75
|
|
|
$loader->load($this->rootDir . '/config/' . DynamicConfigDumper::CONFIG_DEFAULT); |
|
76
|
|
|
} else { |
|
77
|
|
|
$loader->load($this->rootDir . '/config/' . DynamicConfigDumper::CONFIG_GENERATED); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* {@inheritdoc} |
|
83
|
|
|
*/ |
|
84
|
|
|
public function getRootDir() |
|
85
|
|
|
{ |
|
86
|
|
|
return __DIR__; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* {@inheritdoc} |
|
91
|
|
|
*/ |
|
92
|
|
|
public function getCacheDir() |
|
93
|
|
|
{ |
|
94
|
|
|
return dirname(__DIR__).'/var/cache/'.$this->environment; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* {@inheritdoc} |
|
99
|
|
|
*/ |
|
100
|
|
|
public function getLogDir() |
|
101
|
|
|
{ |
|
102
|
|
|
return dirname(__DIR__).'/var/logs'; |
|
103
|
|
|
} |
|
104
|
|
|
} |
|
105
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.