build_bootstrap.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of the Symfony Standard Edition.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. if (!$baseDir = realpath(__DIR__.'/../../../../../../..')) {
  12. exit('Looks like you don\'t have a standard layout.');
  13. }
  14. require_once $baseDir.'/vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
  15. /*
  16. * This file is part of the Symfony package.
  17. *
  18. * (c) Fabien Potencier <fabien@symfony.com>
  19. *
  20. * For the full copyright and license information, please view the LICENSE
  21. * file that was distributed with this source code.
  22. */
  23. use Symfony\Component\ClassLoader\UniversalClassLoader;
  24. use Symfony\Component\ClassLoader\ClassCollectionLoader;
  25. $loader = new UniversalClassLoader();
  26. $loader->registerNamespaces(array('Symfony' => $baseDir.'/vendor/symfony/src'));
  27. $loader->register();
  28. $file = $baseDir.'/app/bootstrap.php.cache';
  29. if (file_exists($file)) {
  30. unlink($file);
  31. }
  32. ClassCollectionLoader::load(array(
  33. 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
  34. 'Symfony\\Component\\DependencyInjection\\Container',
  35. 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface',
  36. 'Symfony\\Component\\HttpKernel\\Bundle\\Bundle',
  37. 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler',
  38. 'Symfony\\Component\\HttpKernel\\HttpKernelInterface',
  39. 'Symfony\\Component\\HttpKernel\\HttpKernel',
  40. 'Symfony\\Component\\HttpKernel\\KernelInterface',
  41. 'Symfony\\Component\\HttpKernel\\Kernel',
  42. 'Symfony\\Component\\HttpFoundation\\ParameterBag',
  43. 'Symfony\\Component\\HttpFoundation\\FileBag',
  44. 'Symfony\\Component\\HttpFoundation\\ServerBag',
  45. 'Symfony\\Component\\HttpFoundation\\HeaderBag',
  46. 'Symfony\\Component\\HttpFoundation\\Request',
  47. 'Symfony\\Component\\HttpFoundation\\ApacheRequest',
  48. 'Symfony\\Component\\ClassLoader\\ClassCollectionLoader',
  49. 'Symfony\\Component\\ClassLoader\\UniversalClassLoader',
  50. 'Symfony\\Component\\ClassLoader\\MapFileClassLoader',
  51. 'Symfony\\Component\\Config\\ConfigCache',
  52. ), dirname($file), basename($file, '.php.cache'), false, false, '.php.cache');
  53. file_put_contents($file, "<?php\n\nnamespace { require_once __DIR__.'/autoload.php'; }\n\n".substr(file_get_contents($file), 5));
  54. $file = $baseDir.'/app/bootstrap_cache.php.cache';
  55. if (file_exists($file)) {
  56. unlink($file);
  57. }
  58. ClassCollectionLoader::load(array(
  59. 'Symfony\\Component\\HttpKernel\\KernelInterface',
  60. 'Symfony\\Component\\HttpKernel\\Kernel',
  61. 'Symfony\\Component\\HttpKernel\\HttpKernelInterface',
  62. 'Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache',
  63. 'Symfony\\Component\\HttpKernel\\HttpCache\\StoreInterface',
  64. 'Symfony\\Component\\HttpKernel\\HttpCache\\Store',
  65. 'Symfony\\Component\\HttpKernel\\HttpCache\\Esi',
  66. 'Symfony\\Component\\HttpFoundation\\ParameterBag',
  67. 'Symfony\\Component\\HttpFoundation\\FileBag',
  68. 'Symfony\\Component\\HttpFoundation\\ServerBag',
  69. 'Symfony\\Component\\HttpFoundation\\HeaderBag',
  70. 'Symfony\\Component\\HttpFoundation\\Request',
  71. 'Symfony\\Component\\HttpFoundation\\ApacheRequest',
  72. 'Symfony\\Component\\HttpFoundation\\ResponseHeaderBag',
  73. 'Symfony\\Component\\HttpFoundation\\Response',
  74. 'Symfony\\Component\\ClassLoader\\UniversalClassLoader',
  75. ), dirname($file), basename($file, '.php.cache'), false, false, '.php.cache');
  76. file_put_contents($file, "<?php\n\nnamespace { require_once __DIR__.'/autoload.php'; }\n\n".substr(file_get_contents($file), 5));