Author: Fabien Potencier (fabien@symfony.com)
Author: Johannes M. Schmitt (schmittjoh@gmail.com)
Inheritance: extends Symfony\Component\DependencyInjection\Dumper\Dumper
 /**
  * @param BundleInterface[] $bundles
  * @param array             $configs
  * @param bool              $compile
  *
  * @return ContainerBuilder
  */
 protected function buildContainer(array $bundles = [], array $configs = [], $compile = true)
 {
     $container = new ContainerBuilder(new ParameterBag(['kernel.debug' => false, 'kernel.bundles' => array_map('get_class', $bundles), 'kernel.cache_dir' => CACHE_DIR . 'test', 'kernel.environment' => 'test', 'kernel.root_dir' => __DIR__]));
     $container->set('annotation_reader', new AnnotationReader());
     $container->addObjectResource($container);
     $extensions = [];
     foreach ($bundles as $bundle) {
         if ($extension = $bundle->getContainerExtension()) {
             $container->registerExtension($extension);
             $extensions[] = $extension->getAlias();
         }
         $container->addObjectResource($bundle);
     }
     foreach ($bundles as $bundle) {
         $bundle->build($container);
     }
     foreach ($configs as $alias => $config) {
         $container->prependExtensionConfig($alias, $config);
     }
     // ensure these extensions are implicitly loaded
     $container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions));
     foreach ($bundles as $bundle) {
         $bundle->setContainer($container);
         $bundle->boot();
     }
     $container->compile();
     $dumper = new PhpDumper($container);
     $dumper->dump();
     return $container;
 }
Esempio n. 2
0
 /**
  * Loads a container and returns it.
  *
  * If the cache file for the service container exists and is current, it
  * will be loaded and returned. Otherwise, a new container will be built
  * using the configuration file and the provided optional builder. The
  * builder will be used to make changes to the service container before
  * it is compiled and cached.
  *
  * It may be important to note that debug mode for the `ConfigCache` class
  * is enabled by default. This will ensure that cached configuration files
  * are updated whenever they are changed.
  *
  * @param string   $containerCacheFilePath     The container cache file path.
  * @param callable $containerBuilderCallable   The new container builder callable.
  * @param string   $compiledContainerClassName The compiled container class name.
  * @param boolean  $debug                      Is debugging mode enabled?
  *
  * @return Jarvis The loaded application.
  */
 public static function create($containerCacheFilePath, callable $containerBuilderCallable = null, $compiledContainerClassName = 'AppCachedContainer', $debug = true)
 {
     $cacheManager = new ConfigCache($containerCacheFilePath, $debug);
     if (!$cacheManager->isFresh()) {
         $container = static::createContainer();
         if (null !== $containerBuilderCallable) {
             $containerBuilderCallable($container);
         }
         if ($debug) {
             $filename = pathinfo($containerCacheFilePath, PATHINFO_DIRNAME) . '/' . pathinfo($containerCacheFilePath, PATHINFO_FILENAME) . '.xml';
             $container->setParameter('debug.container.dump', $filename);
         }
         $container->compile();
         $dumper = new PhpDumper($container);
         $cacheManager->write($dumper->dump(array('class' => $compiledContainerClassName)), $container->getResources());
         if ($debug) {
             $filename = $container->getParameter('debug.container.dump');
             $dumper = new XmlDumper($container);
             $filesystem = new Filesystem();
             $filesystem->dumpFile($filename, $dumper->dump(), null);
             try {
                 $filesystem->chmod($filename, 0666, umask());
             } catch (IOException $e) {
                 // discard chmod failure (some filesystem may not support it)
             }
         }
     }
     if (!class_exists($compiledContainerClassName)) {
         /** @noinspection PhpIncludeInspection */
         require $containerCacheFilePath;
     }
     return new Jarvis(new $compiledContainerClassName());
 }
Esempio n. 3
0
 protected function boot()
 {
     if ($this->hasBooted()) {
         return;
     }
     // Nothing to do
     if ($this->debug) {
         $this->setContainer(new ContainerBuilder(new ParameterBag($this->getAppParameters())));
         $this->loadContainerConfiguration();
     } else {
         $filename = $this->getContainerCacheFilename();
         if (file_exists($filename)) {
             require_once $filename;
             $this->setContainer(new CachedContainer());
         } else {
             $this->setContainer(new ContainerBuilder(new ParameterBag($this->getAppParameters())));
             $this->loadContainerConfiguration();
             $this->container->compile();
             if ($this->containerIsCacheable()) {
                 $dumper = new PhpDumper($this->container);
                 file_put_contents($filename, $dumper->dump());
             }
         }
     }
 }
Esempio n. 4
0
 /**
  * Builds the container.
  * @param array $parameters
  */
 public function build($parameters = array())
 {
     // sort array by key to generate the container name
     ksort($parameters);
     // needed for new packages installed
     $composerClass = array_filter(get_declared_classes(), function ($item) {
         if (0 === strpos($item, 'ComposerAutoloaderInit')) {
             return true;
         }
     });
     $composerClass = array_pop($composerClass);
     // generate hash
     $parametersHash = md5(serialize($parameters) . $composerClass);
     $containerClass = 'Container' . $parametersHash;
     $isDebug = true;
     $file = sprintf('%s/ladybug_cache/%s.php', sys_get_temp_dir(), $parametersHash);
     $containerConfigCache = new ConfigCache($file, $isDebug);
     if (!$containerConfigCache->isFresh()) {
         $this->initializeContainer();
         $this->loadServices();
         $this->loadThemes();
         $this->loadPlugins();
         $this->setParameters($parameters);
         $this->container->compile();
         $dumper = new PhpDumper($this->container);
         $containerConfigCache->write($dumper->dump(array('class' => $containerClass)), $this->container->getResources());
     } else {
         require_once $file;
         $this->container = new $containerClass();
     }
 }
Esempio n. 5
0
 public function compile()
 {
     foreach (PluginRepository::findAll() as $plugin) {
         $containerBuilder = new UnfreezableContainerBuilder();
         $containerBuilder->registerExtension(new GeneralExtension());
         $extensionClass = new \ReflectionClass('Stagehand\\TestRunner\\DependencyInjection\\Extension\\' . $plugin->getPluginID() . 'Extension');
         if (!$extensionClass->isInterface() && !$extensionClass->isAbstract() && $extensionClass->isSubclassOf('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')) {
             $containerBuilder->registerExtension($extensionClass->newInstance());
         }
         foreach ($containerBuilder->getExtensions() as $extension) {
             /* @var $extension \Symfony\Component\DependencyInjection\Extension\ExtensionInterface */
             $containerBuilder->loadFromExtension($extension->getAlias(), array());
         }
         $containerBuilder->addCompilerPass(new ReplaceDefinitionByPluginDefinitionPass($plugin));
         $containerBuilder->getCompilerPassConfig()->setOptimizationPasses(array_filter($containerBuilder->getCompilerPassConfig()->getOptimizationPasses(), function (CompilerPassInterface $compilerPass) {
             return !$compilerPass instanceof ResolveParameterPlaceHoldersPass;
         }));
         ErrorReporting::invokeWith(error_reporting() & ~E_USER_DEPRECATED, function () use($containerBuilder) {
             $containerBuilder->compile();
         });
         $phpDumper = new PhpDumper($containerBuilder);
         $containerClass = $plugin->getPluginID() . 'Container';
         $containerClassSource = $phpDumper->dump(array('class' => $containerClass));
         $containerClassSource = preg_replace('/^<\\?php/', '<?php' . PHP_EOL . 'namespace ' . self::COMPILED_CONTAINER_NAMESPACE . ';' . PHP_EOL, $containerClassSource);
         file_put_contents(__DIR__ . '/../' . $containerClass . '.php', $containerClassSource);
     }
 }
 public static function warmup()
 {
     $containerFile = self::getCacheDir() . '/container.php';
     $builder = self::getContainer();
     $dumper = new PhpDumper($builder);
     file_put_contents($containerFile, $dumper->dump());
 }
 function it_uses_container_dump_to_create_the_cache(Filesystem $filesystem, ContainerDumperFactory $dumperFactory, ContainerBuilder $containerBuilder, PhpDumper $dumper)
 {
     $dumper->dump()->willReturn('file contents');
     $dumperFactory->create($containerBuilder)->willReturn($dumper);
     $this->dump($containerBuilder);
     $filesystem->dumpFile($this->path, 'file contents')->shouldHaveBeenCalled();
 }
Esempio n. 8
0
 /**
  * Dumps the service container to PHP code in the cache.
  *
  * @param ConfigCache      $cache     The config cache
  * @param ContainerBuilder $container The service container
  * @param string           $class     The name of the class to generate
  * @param string           $baseClass The name of the container's base class
  */
 protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass)
 {
     // cache the container
     $dumper = new PhpDumper($container);
     $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'optimize_strings' => false));
     $cache->write($content, $container->getResources());
 }
 function it_uses_config_cache_to_create_the_cache(Filesystem $filesystem, ContainerDumperFactory $dumperFactory, ContainerBuilder $containerBuilder, PhpDumper $dumper, ConfigCache $configCache)
 {
     $dumper->dump()->willReturn('file contents');
     $dumperFactory->create($containerBuilder)->willReturn($dumper);
     $containerBuilder->getResources()->willReturn([]);
     $this->dump($containerBuilder);
     $configCache->write('file contents', [])->shouldHaveBeenCalled();
 }
Esempio n. 10
0
 protected function getDumper(SymfonyBuilder $container) : DumperInterface
 {
     $dumper = new PhpDumper($container);
     if (class_exists(ProxyDumper::class)) {
         $dumper->setProxyDumper(new ProxyDumper());
     }
     return $dumper;
 }
Esempio n. 11
0
 /**
  * @param SymfonyRequest $symfonyRequest
  * @param string $filePath
  */
 private function dumpContainer(SymfonyRequest $symfonyRequest, $filePath)
 {
     $containerConfigCache = new ConfigCache($filePath, $this->appMode === ApplicationMode::DEVELOPMENT);
     if (!$containerConfigCache->isFresh()) {
         $containerBuilder = ServiceContainerBuilder::create($this->appPath, $symfonyRequest, $this->appMode);
         $dumper = new PhpDumper($containerBuilder);
         $containerConfigCache->write($dumper->dump(['class' => 'ACP3ServiceContainer']), $containerBuilder->getResources());
     }
 }
Esempio n. 12
0
 protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass)
 {
     $dumper = new PhpDumper($container);
     $namespace = null;
     if (($p = strrpos($class, "\\")) !== false) {
         $namespace = substr($class, 0, $p);
         $class = substr($class, $p + 1);
     }
     $content = $dumper->dump(["namespace" => $namespace, "class" => $class, "base_class" => $baseClass]);
     $cache->write($content, $container->getResources());
 }
 public function testDumpContainerWithProxyService()
 {
     $container = new ContainerBuilder();
     $container->register('foo', 'stdClass');
     $container->getDefinition('foo')->setLazy(true);
     $container->compile();
     $dumper = new PhpDumper($container);
     $dumper->setProxyDumper(new ProxyDumper());
     $dumpedString = $dumper->dump();
     $this->assertStringMatchesFormatFile(__DIR__ . '/../Fixtures/php/lazy_service_structure.txt', $dumpedString, '->dump() does generate proxy lazy loading logic.');
 }
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $file = sprintf('%s/%s', $this->getRoot(), $this->file);
     $output->writeln('Caching the container:');
     $output->writeln(sprintf("\tFile:\t\t%s", $file));
     $container = \Maverick\bootstrap($this->getRoot(), true);
     $container->compile();
     $dumper = new PhpDumper($container);
     $dumped = $dumper->dump(['namespace' => $this->namespace, 'class' => $this->class]);
     file_put_contents($file, $dumped);
 }
Esempio n. 15
0
 public function getContainer()
 {
     $container = new ContainerBuilder(new ParameterBag(array('kernel.bundle_dirs' => array(), 'kernel.bundles' => array(), 'kernel.cache_dir' => sys_get_temp_dir())));
     $loader = new DoctrineMongoDBExtension();
     $container->registerExtension($loader);
     $loader->mongodbLoad(array(), $container);
     $dumper = new PhpDumper($container);
     $code = $dumper->dump(array('class' => 'DoctrineMongoDBBundleTestsProjectServiceContainer'));
     eval(str_replace('<?php', null, $code));
     return new \DoctrineMongoDBBundleTestsProjectServiceContainer();
 }
Esempio n. 16
0
 private static function dumpForEnvironment($environment)
 {
     $container = new ContainerBuilder();
     $yml_filename = self::FILENAME . ($environment ? '_testing' : '') . '.yml';
     $php_file_path = __DIR__ . '/Services/' . self::FILENAME . ($environment ? '_testing' : '') . '.php';
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/Services'));
     $loader->setResolver(new LoaderResolver([new PhpFileLoader($container, new FileLocator(__DIR__ . '/Services'))]));
     $loader->load($yml_filename);
     $container->compile();
     $dumper = new PhpDumper($container);
     file_put_contents($php_file_path, $dumper->dump(['class' => ucfirst($environment) . 'ServiceContainer']));
 }
 /**
  * @param array $configs
  *
  * @param BundleInterface[] $bundles
  * @return ContainerBuilder
  */
 protected function buildContainer(array $bundles = array(), array $configs = array())
 {
     $container = new ContainerBuilder();
     foreach ($bundles as $bundle) {
         $bundle->build($container);
         $this->loadExtension($bundle, $container, $configs);
     }
     $container->compile();
     $dumper = new PhpDumper($container);
     $dumper->dump();
     return $container;
 }
 protected function getDumpedContainer()
 {
     static $i = 0;
     $class = 'PaginatorExtensionTestContainer' . $i++;
     $this->container->compile();
     $dumper = new PhpDumper($this->container);
     eval('?>' . $dumper->dump(array('class' => $class)));
     $container = new $class();
     $container->enterScope('request');
     $container->set('kernel', $this->kernel);
     return $container;
 }
Esempio n. 19
0
 public function getContainer()
 {
     $container = new ContainerBuilder(new ParameterBag(array('kernel.bundle_dirs' => array('DoctrineBundle\\Tests\\DependencyInjection\\Fixtures\\Bundles' => __DIR__ . "/DependencyInjection/Fixtures/Bundles"), 'kernel.bundles' => array('DoctrineBundle\\Tests\\DependencyInjection\\Fixtures\\Bundles\\YamlBundle\\YamlBundle'), 'kernel.cache_dir' => sys_get_temp_dir())));
     $loader = new DoctrineExtension();
     $container->registerExtension($loader);
     $loader->dbalLoad(array('connections' => array('default' => array('driver' => 'pdo_mysql', 'charset' => 'UTF-8', 'platform-service' => 'my.platform'))), $container);
     $loader->ormLoad(array('bundles' => array('YamlBundle' => array())), $container);
     $container->setDefinition('my.platform', new \Symfony\Component\DependencyInjection\Definition('Doctrine\\DBAL\\Platforms\\MySqlPlatform'));
     $dumper = new PhpDumper($container);
     $code = $dumper->dump(array('class' => 'DoctrineBundleTestsProjectServiceContainer'));
     eval(str_replace('<?php', null, $code));
     return new \DoctrineBundleTestsProjectServiceContainer();
 }
 /**
  * @param boolean $evaluatable
  * @return string
  */
 public function compile($evaluatable = false)
 {
     $this->containerBuilder->compile();
     $phpDumper = new PhpDumper($this->containerBuilder);
     $containerClassSource = $phpDumper->dump(array('class' => $this->class));
     if (!is_null($this->namespace)) {
         $containerClassSource = preg_replace('/^<\\?php/', '<?php' . PHP_EOL . 'namespace ' . $this->namespace . ';' . PHP_EOL, $containerClassSource);
     }
     if ($evaluatable) {
         $containerClassSource = preg_replace('/^<\\?php/', '', $containerClassSource);
     }
     return $containerClassSource;
 }
 /**
  * @param array $configs
  *
  * @param BundleInterface[] $bundles
  * @return ContainerBuilder
  */
 protected function buildContainer(array $bundles = array(), array $configs = array())
 {
     $container = new ContainerBuilder(new ParameterBag(array('kernel.debug' => false, 'kernel.bundles' => $bundles, 'kernel.cache_dir' => sys_get_temp_dir(), 'kernel.environment' => 'test', 'kernel.root_dir' => __DIR__)));
     $container->set('annotation_reader', new AnnotationReader());
     foreach ($bundles as $bundle) {
         $bundle->build($container);
         $this->loadExtension($bundle, $container, $configs);
     }
     $container->compile();
     $dumper = new PhpDumper($container);
     $dumper->dump();
     return $container;
 }
Esempio n. 22
0
 /**
  * @return ContainerInterface
  */
 protected function getContainerBuilderCached($contextFile, $cacheDir, $isDebug, $loaderFactory)
 {
     $contextFile = realpath($contextFile);
     $className = "c" . Base32Hex::encode($contextFile);
     $file = $cacheDir . '/' . $className;
     $containerConfigCache = new ConfigCache($file, $isDebug);
     if (!$containerConfigCache->isFresh()) {
         $containerBuilder = $this->buildContainer($contextFile, $loaderFactory);
         $dumper = new PhpDumper($containerBuilder);
         $containerConfigCache->write($dumper->dump(array('class' => $className)), $containerBuilder->getResources());
     }
     require_once $file;
     return new $className();
 }
Esempio n. 23
0
 /**
  * Load DI config for all symfonized modules
  *
  * @param string $cacheDirPath
  * @param boolean $cacheEnabled
  * @param array $extensions
  * @param ContainerInterface $container
  * @return ContainerInterface
  */
 public function loadDIConfig($cacheDirPath, $cacheEnabled, $extensions, ContainerInterface $container)
 {
     $cacheClass = 'CachedSymfonyContainerWithZFFallback';
     $cachePath = $cacheDirPath . '/' . $cacheClass . '.php';
     $cache = new ConfigCache($cachePath, !$cacheEnabled);
     if (!$cache->isFresh()) {
         foreach ($extensions as $extension) {
             $extension->load([], $container);
         }
         $dumper = new PhpDumper($container);
         $cache->write($dumper->dump(['class' => $cacheClass, 'base_class' => '\\Reliv\\SymfonizeZF\\ContainerBridge\\SymfonyContainerWithZFFallback']));
     }
     require $cachePath;
     return new $cacheClass();
 }
Esempio n. 24
0
 public function testAddService()
 {
     $container = (include self::$fixturesPath . '/containers/container9.php');
     $dumper = new PhpDumper($container);
     $this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath . '/php/services9.php')), $dumper->dump(), '->dump() dumps services');
     $dumper = new PhpDumper($container = new ContainerBuilder());
     $container->register('foo', 'FooClass')->addArgument(new \stdClass());
     try {
         $dumper->dump();
         $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
     } catch (\Exception $e) {
         $this->assertInstanceOf('\\Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
         $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
     }
 }
Esempio n. 25
0
 protected function dumpDi()
 {
     $container = $this->container->get('symfony.container');
     if ($container instanceof ContainerBuilder) {
         $containerCache = static::NAMESPACE_DI_CACHE;
         $exploded = explode('\\', $containerCache);
         $class = array_pop($exploded);
         $namespace = implode('\\', $exploded);
         $phpDumper = new PhpDumper($container);
         $dump = $phpDumper->dump(['class' => $class, 'namespace' => $namespace]);
         if (file_exists($this->approot . static::FILE_DI_CACHE)) {
             chmod($this->approot . static::FILE_DI_CACHE, 0756);
         }
         file_put_contents($this->approot . static::FILE_DI_CACHE, $dump);
     }
 }
Esempio n. 26
0
 /**
  * Return dependency injection container
  * 
  * @params string $controller controller name 
  * 
  * @return \Symfony\Component\DependencyInjection\ContainerBuilder
  */
 public function getContainer()
 {
     if (DEVELOPMENT_ENVIRONMENT) {
         $container = $this->createContainer();
     } else {
         $file = DICACHE;
         if (file_exists($file)) {
             $container = new \DI\Container\ServiceContainer();
         } else {
             $container = $this->createContainer();
             $dumper = new PhpDumper($container);
             file_put_contents($file, $dumper->dump(array('class' => 'ServiceContainer', 'namespace' => 'DI\\Container')));
         }
     }
     return $container;
 }
Esempio n. 27
0
 public function testConfigFreshness()
 {
     touch(__FILE__, time() - 3600);
     $cache = new ConfigCache(static::$cacheDir . DIRECTORY_SEPARATOR . 'cache', TRUE);
     $container = new ContainerBuilder();
     $locator = new FileLocator(__DIR__);
     $loader = new YamlArrayLoader($container, $locator);
     $loader->load(__FILE__, NULL, array('parameters' => array('x' => 'y')));
     $container->compile();
     $dumper = new PhpDumper($container);
     $cache->write($dumper->dump(), $container->getResources());
     $this->assertTrue($cache->isFresh());
     touch(__FILE__, time() + 5);
     $this->assertFalse($cache->isFresh());
     $this->assertEquals($container->getParameter('x'), 'y');
 }
Esempio n. 28
0
File: Kernel.php Progetto: havvg/psi
 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     if ($this->booted) {
         return;
     }
     if (!$this->configCache->isFresh()) {
         $this->container = $this->createContainerBuilder();
         $this->container->compile();
         $dumper = new PhpDumper($this->container);
         $cache = $dumper->dump(['namespace' => __NAMESPACE__, 'class' => 'CachedContainer', 'file' => $this->configCache->getPath()]);
         $this->configCache->write($cache, $this->container->getResources());
     }
     require_once $this->configCache->getPath();
     $this->container = new CachedContainer();
     $this->booted = true;
 }
 /**
  * @param string $appPath
  * @param string $env
  *
  * @return CompiledContainer
  */
 public static function getContainer($appPath, $env = null)
 {
     static::$appPath = $appPath;
     static::$cachePath = $appPath . '/app/cache';
     static::$configPath = $appPath . '/app/config';
     $containerCacheFile = static::$cachePath . '/container.php';
     $containerConfigCache = new ConfigCache($containerCacheFile, $env != 'prod');
     if (!$containerConfigCache->isFresh()) {
         $containerBuilder = static::buildContainer();
         $dumper = new PhpDumper($containerBuilder);
         $containerConfigCache->write($dumper->dump(array('class' => 'CompiledContainer')), $containerBuilder->getResources());
     }
     require_once $containerCacheFile;
     $container = new CompiledContainer();
     return $container;
 }
Esempio n. 30
0
 static function getContainer()
 {
     static $container;
     if ($container) {
         return $container;
     }
     $cache = TIKI_PATH . '/temp/cache/container.php';
     if (is_readable($cache)) {
         require_once $cache;
         $container = new TikiCachedContainer();
         if (TikiDb::get()) {
             $container->set('tiki.lib.db', TikiDb::get());
         }
         return $container;
     }
     $path = TIKI_PATH . '/db/config';
     $container = new ContainerBuilder();
     $container->addCompilerPass(new \Tiki\MailIn\Provider\CompilerPass());
     $container->addCompilerPass(new \Tiki\Recommendation\Engine\CompilerPass());
     $container->addCompilerPass(new \Tiki\Wiki\SlugManager\CompilerPass());
     $container->addCompilerPass(new \Search\Federated\CompilerPass());
     $container->addCompilerPass(new \Tracker\CompilerPass());
     $container->setParameter('kernel.root_dir', TIKI_PATH);
     $loader = new XmlFileLoader($container, new FileLocator($path));
     $loader->load('tiki.xml');
     $loader->load('controllers.xml');
     $loader->load('mailin.xml');
     try {
         $loader->load('custom.xml');
     } catch (InvalidArgumentException $e) {
         // Do nothing, absence of custom.xml file is expected
     }
     foreach (glob(TIKI_PATH . '/addons/*/lib/libs.xml') as $file) {
         try {
             $loader->load($file);
         } catch (InvalidArgumentException $e) {
             // Do nothing, absence of libs.xml file is expected
         }
     }
     if (TikiDb::get()) {
         $container->set('tiki.lib.db', TikiDb::get());
     }
     $container->compile();
     $dumper = new PhpDumper($container);
     file_put_contents($cache, $dumper->dump(['class' => 'TikiCachedContainer']));
     return $container;
 }