build_bootstrap.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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\\ContainerAwareInterface',
  34. 'Symfony\\Component\\DependencyInjection\\ContainerAware',
  35. 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
  36. 'Symfony\\Component\\DependencyInjection\\Container',
  37. 'Symfony\\Component\\HttpKernel\\HttpKernelInterface',
  38. 'Symfony\\Component\\HttpKernel\\KernelInterface',
  39. 'Symfony\\Component\\HttpKernel\\Kernel',
  40. 'Symfony\\Component\\ClassLoader\\ClassCollectionLoader',
  41. 'Symfony\\Component\\ClassLoader\\UniversalClassLoader',
  42. 'Symfony\\Component\\HttpKernel\\Bundle\\Bundle',
  43. 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface',
  44. 'Symfony\\Component\\Config\\ConfigCache',
  45. // cannot be included as commands are discovered based on the path to this class via Reflection
  46. //'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle',
  47. ), dirname($file), basename($file, '.php.cache'), false, false, '.php.cache');
  48. file_put_contents($file, "<?php\n\nnamespace { require_once __DIR__.'/autoload.php'; }\n\n".substr(file_get_contents($file), 5));