|
@@ -565,6 +565,16 @@ abstract class Kernel implements KernelInterface
|
|
|
*/
|
|
|
protected function buildContainer()
|
|
|
{
|
|
|
+ foreach (array('cache' => $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) {
|
|
|
+ if (!is_dir($dir)) {
|
|
|
+ if (false === @mkdir($dir, 0777, true)) {
|
|
|
+ throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, dirname($dir)));
|
|
|
+ }
|
|
|
+ } elseif (!is_writable($dir)) {
|
|
|
+ throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$container = new ContainerBuilder(new ParameterBag($this->getKernelParameters()));
|
|
|
$extensions = array();
|
|
|
foreach ($this->bundles as $bundle) {
|
|
@@ -588,17 +598,6 @@ abstract class Kernel implements KernelInterface
|
|
|
$container->merge($cont);
|
|
|
}
|
|
|
|
|
|
- foreach (array('cache', 'logs') as $name) {
|
|
|
- $dir = $container->getParameter(sprintf('kernel.%s_dir', $name));
|
|
|
- if (!is_dir($dir)) {
|
|
|
- if (false === @mkdir($dir, 0777, true)) {
|
|
|
- throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, dirname($dir)));
|
|
|
- }
|
|
|
- } elseif (!is_writable($dir)) {
|
|
|
- throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
$container->addCompilerPass(new AddClassesToCachePass($this));
|
|
|
$container->compile();
|
|
|
|