Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. namespace SymfonyComponentHttpKernel;
  2.  
  3. ...
  4.  
  5.  
  6. /**
  7. * The Kernel is the heart of the Symfony system.
  8. *
  9. * It manages an environment made of bundles.
  10. *
  11. * @author Fabien Potencier <fabien@symfony.com>
  12. */
  13. abstract class Kernel implements KernelInterface, TerminableInterface
  14. {
  15. ...
  16. /**
  17. * Initializes the service container.
  18. *
  19. * The cached version of the service container is used when fresh, otherwise the
  20. * container is built.
  21. */
  22. protected function initializeContainer()
  23. {
  24. $class = $this->getContainerClass();
  25. // !!!!!! cache config object construction
  26. $cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug);
  27. $fresh = true;
  28. if (!$cache->isFresh()) {
  29. $container = $this->buildContainer();
  30. $container->compile();
  31. $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass());
  32.  
  33. $fresh = false;
  34. }
  35.  
  36. require_once $cache->getPath();
  37.  
  38. $this->container = new $class();
  39. $this->container->set('kernel', $this);
  40.  
  41. if (!$fresh && $this->container->has('cache_warmer')) {
  42. $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'));
  43. }
  44. }
  45. }
  46.  
  47. -home
  48.  
  49. --symfony_app
  50.  
  51. --custom_cache_directory
  52.  
  53. public function getCacheDir()
  54. {
  55. return dirname(__DIR__).'/../custom_cache_directory/cache/'.$this->getEnvironment();
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement