Make kernel build time optionally deterministic
This commit is contained in:
parent
05a045268f
commit
48e8249da9
@ -119,6 +119,7 @@ class PhpDumper extends Dumper
|
|||||||
'debug' => true,
|
'debug' => true,
|
||||||
'hot_path_tag' => 'container.hot_path',
|
'hot_path_tag' => 'container.hot_path',
|
||||||
'inline_class_loader_parameter' => 'container.dumper.inline_class_loader',
|
'inline_class_loader_parameter' => 'container.dumper.inline_class_loader',
|
||||||
|
'build_time' => time(),
|
||||||
), $options);
|
), $options);
|
||||||
|
|
||||||
$this->namespace = $options['namespace'];
|
$this->namespace = $options['namespace'];
|
||||||
@ -216,7 +217,7 @@ EOF;
|
|||||||
array_pop($code);
|
array_pop($code);
|
||||||
$code["Container{$hash}/{$options['class']}.php"] = substr_replace($files[$options['class'].'.php'], "<?php\n\nnamespace Container{$hash};\n", 0, 6);
|
$code["Container{$hash}/{$options['class']}.php"] = substr_replace($files[$options['class'].'.php'], "<?php\n\nnamespace Container{$hash};\n", 0, 6);
|
||||||
$namespaceLine = $this->namespace ? "\nnamespace {$this->namespace};\n" : '';
|
$namespaceLine = $this->namespace ? "\nnamespace {$this->namespace};\n" : '';
|
||||||
$time = time();
|
$time = $options['build_time'];
|
||||||
$id = hash('crc32', $hash.$time);
|
$id = hash('crc32', $hash.$time);
|
||||||
|
|
||||||
$code[$options['class'].'.php'] = <<<EOF
|
$code[$options['class'].'.php'] = <<<EOF
|
||||||
|
@ -855,6 +855,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
'as_files' => true,
|
'as_files' => true,
|
||||||
'debug' => $this->debug,
|
'debug' => $this->debug,
|
||||||
'inline_class_loader_parameter' => \PHP_VERSION_ID >= 70000 && !$this->loadClassCache && !class_exists(ClassCollectionLoader::class, false) ? 'container.dumper.inline_class_loader' : null,
|
'inline_class_loader_parameter' => \PHP_VERSION_ID >= 70000 && !$this->loadClassCache && !class_exists(ClassCollectionLoader::class, false) ? 'container.dumper.inline_class_loader' : null,
|
||||||
|
'build_time' => $container->hasParameter('kernel.container_build_time') ? $container->getParameter('kernel.container_build_time') : time(),
|
||||||
));
|
));
|
||||||
|
|
||||||
$rootCode = array_pop($content);
|
$rootCode = array_pop($content);
|
||||||
|
Reference in New Issue
Block a user