Skip to content
Snippets Groups Projects
Verified Commit 3de0152f authored by Bartek Jaskulski's avatar Bartek Jaskulski
Browse files

feat: don't rebuild compiled container

parent 56b25b21
Branches
Tags
2 merge requests!3improve into wp-hook and some additional unfinished things,!21.x
...@@ -85,12 +85,21 @@ final class Kernel { ...@@ -85,12 +85,21 @@ final class Kernel {
); );
} }
private function get_container_name( Plugin $plugin ): string {
return str_replace( '-', '_', $plugin->get_slug() ) . '_container';
}
private function initialize_container( Plugin $plugin ): Container { private function initialize_container( Plugin $plugin ): Container {
$original_builder = new DiBuilder(); $original_builder = new DiBuilder();
$original_builder->enableCompilation( $original_builder->enableCompilation(
$this->get_cache_path(), $this->get_cache_path(),
str_replace( '-', '_', $plugin->get_slug() ) . '_container' $this->get_container_name( $plugin )
); );
if ( file_exists( $this->get_cache_path( $this->get_container_name( $plugin ) . '.php' ) ) ) {
return $original_builder->build();
}
$builder = new ContainerBuilder( $original_builder ); $builder = new ContainerBuilder( $original_builder );
foreach ( $this->extensions as $extension ) { foreach ( $this->extensions as $extension ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment