From 3fe385e4fba4b167b0925defc062c4a0f977051d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 28 Apr 2011 13:36:52 +0200 Subject: [PATCH] removed the autoloader map feature This feature added complexity to the framework but wasn't used in the core anyway. You can still use the Map class loader in your application though. But most of the time, using the APC autoloader is just better. --- .../CacheWarmer/ClassMapCacheWarmer.php | 66 ------------------- .../Compiler/AddClassesToAutoloadMapPass.php | 39 ----------- .../FrameworkBundle/FrameworkBundle.php | 8 --- .../Resources/config/services.xml | 6 -- .../DependencyInjection/Extension.php | 21 ------ 5 files changed, 140 deletions(-) delete mode 100644 src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ClassMapCacheWarmer.php delete mode 100644 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddClassesToAutoloadMapPass.php diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ClassMapCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ClassMapCacheWarmer.php deleted file mode 100644 index c6671e220168..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ClassMapCacheWarmer.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\FrameworkBundle\CacheWarmer; - -use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Generates an autoload class map cache. - * - * @author Fabien Potencier - */ -class ClassMapCacheWarmer extends CacheWarmer -{ - protected $container; - - /** - * Constructor. - * - * @param ContainerInterface $container The container - */ - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - /** - * Warms up the cache. - * - * @param string $cacheDir The cache directory - */ - public function warmUp($cacheDir) - { - if (!$this->container->hasParameter('kernel.autoload_classes')) { - return; - } - - $classes = array(); - foreach ($this->container->getParameter('kernel.autoload_classes') as $class) { - $r = new \ReflectionClass($class); - - $classes[$class] = $r->getFilename(); - } - - $this->writeCacheFile($cacheDir.'/autoload.php', sprintf(' - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -/** - * Sets the class map for the autoloader. - * - * @author Fabien Potencier - */ -class AddClassesToAutoloadMapPass implements CompilerPassInterface -{ - /** - * {@inheritDoc} - */ - public function process(ContainerBuilder $container) - { - $classes = array(); - foreach ($container->getExtensions() as $extension) { - if ($extension instanceof Extension) { - $classes = array_merge($classes, $extension->getAutoloadClassMap()); - } - } - - $container->setParameter('kernel.autoload_classes', array_unique($classes)); - } -} diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index 9a06ff198e84..cdda39ecfc6b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -18,7 +18,6 @@ use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RoutingResolverPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddClassesToCachePass; -use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddClassesToAutoloadMapPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ContainerBuilderDebugDumpPass; @@ -29,7 +28,6 @@ use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\ClassLoader\ClassCollectionLoader; -use Symfony\Component\ClassLoader\MapFileClassLoader; /** * Bundle. @@ -55,11 +53,6 @@ public function boot() if ($this->container->has('error_handler')) { $this->container->get('error_handler'); } - - if (file_exists($this->container->getParameter('kernel.cache_dir').'/autoload.php')) { - $classloader = new MapFileClassLoader($this->container->getParameter('kernel.cache_dir').'/autoload.php'); - $classloader->register(true); - } } public function build(ContainerBuilder $container) @@ -75,7 +68,6 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new AddConstraintValidatorsPass()); $container->addCompilerPass(new FormPass()); $container->addCompilerPass(new AddClassesToCachePass()); - $container->addCompilerPass(new AddClassesToAutoloadMapPass()); $container->addCompilerPass(new TranslatorPass()); $container->addCompilerPass(new AddCacheWarmerPass()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml index 72893486849d..84423f66bc48 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml @@ -10,7 +10,6 @@ Symfony\Component\HttpKernel\Debug\ErrorHandler Symfony\Component\HttpKernel\Util\Filesystem Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate - Symfony\Bundle\FrameworkBundle\CacheWarmer\ClassMapCacheWarmer Symfony\Component\HttpKernel\Config\FileLocator @@ -33,11 +32,6 @@ - - - - -