diff --git a/src/Symfony/Framework/DoctrineBundle/Debug/DoctrineDataCollector.php b/src/Symfony/Framework/DoctrineBundle/DataCollector/DoctrineDataCollector.php similarity index 91% rename from src/Symfony/Framework/DoctrineBundle/Debug/DoctrineDataCollector.php rename to src/Symfony/Framework/DoctrineBundle/DataCollector/DoctrineDataCollector.php index a147dea296..64e5819382 100644 --- a/src/Symfony/Framework/DoctrineBundle/Debug/DoctrineDataCollector.php +++ b/src/Symfony/Framework/DoctrineBundle/DataCollector/DoctrineDataCollector.php @@ -1,8 +1,8 @@ - - Symfony\Framework\DoctrineBundle\Debug\DoctrineDataCollector - + Symfony\Framework\DoctrineBundle\DataCollector\DoctrineDataCollector @@ -17,8 +15,8 @@ - - + + diff --git a/src/Symfony/Framework/ProfilerBundle/Bundle.php b/src/Symfony/Framework/ProfilerBundle/Bundle.php new file mode 100644 index 0000000000..527147c50c --- /dev/null +++ b/src/Symfony/Framework/ProfilerBundle/Bundle.php @@ -0,0 +1,31 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +/** + * + * + * @package symfony + * @author Fabien Potencier + */ +class Bundle extends BaseBundle +{ + public function buildContainer(ContainerInterface $container) + { + Loader::registerExtension(new ProfilerExtension()); + } +} diff --git a/src/Symfony/Framework/WebBundle/Debug/DataCollector/AppDataCollector.php b/src/Symfony/Framework/ProfilerBundle/DataCollector/AppDataCollector.php similarity index 97% rename from src/Symfony/Framework/WebBundle/Debug/DataCollector/AppDataCollector.php rename to src/Symfony/Framework/ProfilerBundle/DataCollector/AppDataCollector.php index 9c15c68e47..dfa8e7318b 100644 --- a/src/Symfony/Framework/WebBundle/Debug/DataCollector/AppDataCollector.php +++ b/src/Symfony/Framework/ProfilerBundle/DataCollector/AppDataCollector.php @@ -1,6 +1,6 @@ container->findAnnotatedServiceIds('debug.collector'); + $config = $this->container->findAnnotatedServiceIds('data_collector'); $ids = array(); $coreColectors = array(); $userCollectors = array(); diff --git a/src/Symfony/Framework/WebBundle/Debug/DataCollector/MemoryDataCollector.php b/src/Symfony/Framework/ProfilerBundle/DataCollector/MemoryDataCollector.php similarity index 95% rename from src/Symfony/Framework/WebBundle/Debug/DataCollector/MemoryDataCollector.php rename to src/Symfony/Framework/ProfilerBundle/DataCollector/MemoryDataCollector.php index 3dfe1ef3fa..17d6789f30 100644 --- a/src/Symfony/Framework/WebBundle/Debug/DataCollector/MemoryDataCollector.php +++ b/src/Symfony/Framework/ProfilerBundle/DataCollector/MemoryDataCollector.php @@ -1,6 +1,6 @@ + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +/** + * ProfilerExtension manages the data collectors and the web debug toolbar. + * + * @package symfony + * @author Fabien Potencier + */ +class ProfilerExtension extends LoaderExtension +{ + public function configLoad($config) + { + $configuration = new BuilderConfiguration(); + + $loader = new XmlFileLoader(__DIR__.'/../Resources/config'); + $configuration->merge($loader->load('collectors.xml')); + + if (isset($config['toolbar']) && $config['toolbar']) + { + $configuration->merge($loader->load('toolbar.xml')); + } + + return $configuration; + } + + /** + * Returns the base path for the XSD files. + * + * @return string The XSD base path + */ + public function getXsdValidationBasePath() + { + return __DIR__.'/../Resources/config/'; + } + + public function getNamespace() + { + return 'http://www.symfony-project.org/schema/dic/symfony/profiler'; + } + + public function getAlias() + { + return 'profiler'; + } +} diff --git a/src/Symfony/Framework/WebBundle/Debug/WebDebugToolbar.php b/src/Symfony/Framework/ProfilerBundle/Listener/WebDebugToolbar.php similarity index 95% rename from src/Symfony/Framework/WebBundle/Debug/WebDebugToolbar.php rename to src/Symfony/Framework/ProfilerBundle/Listener/WebDebugToolbar.php index 7fb07ca9db..71e32db83c 100644 --- a/src/Symfony/Framework/WebBundle/Debug/WebDebugToolbar.php +++ b/src/Symfony/Framework/ProfilerBundle/Listener/WebDebugToolbar.php @@ -1,11 +1,11 @@ + + + + + Symfony\Framework\ProfilerBundle\DataCollector\DataCollectorManager + 86400 + Symfony\Framework\ProfilerBundle\DataCollector\ConfigDataCollector + Symfony\Framework\ProfilerBundle\DataCollector\AppDataCollector + Symfony\Framework\ProfilerBundle\DataCollector\TimerDataCollector + Symfony\Framework\ProfilerBundle\DataCollector\MemoryDataCollector + + + + + + + %data_collector_manager.lifetime% + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Symfony/Framework/ProfilerBundle/Resources/config/schema/dic/symfony/profiler-1.0.xsd b/src/Symfony/Framework/ProfilerBundle/Resources/config/schema/dic/symfony/profiler-1.0.xsd new file mode 100644 index 0000000000..b77f7fa99f --- /dev/null +++ b/src/Symfony/Framework/ProfilerBundle/Resources/config/schema/dic/symfony/profiler-1.0.xsd @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/src/Symfony/Framework/WebBundle/Resources/config/debug_web_debug_toolbar.xml b/src/Symfony/Framework/ProfilerBundle/Resources/config/toolbar.xml similarity index 66% rename from src/Symfony/Framework/WebBundle/Resources/config/debug_web_debug_toolbar.xml rename to src/Symfony/Framework/ProfilerBundle/Resources/config/toolbar.xml index 795c6953db..92cc40dba1 100644 --- a/src/Symfony/Framework/WebBundle/Resources/config/debug_web_debug_toolbar.xml +++ b/src/Symfony/Framework/ProfilerBundle/Resources/config/toolbar.xml @@ -5,14 +5,14 @@ xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd"> - Symfony\Framework\WebBundle\Debug\WebDebugToolbar + Symfony\Framework\ProfilerBundle\Listener\WebDebugToolbar - + - + diff --git a/src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php b/src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php index cfa694283c..c6052d1c5d 100644 --- a/src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php +++ b/src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php @@ -27,7 +27,6 @@ class WebExtension extends LoaderExtension protected $resources = array( 'templating' => 'templating.xml', 'web' => 'web.xml', - 'debug' => 'debug.xml', 'user' => 'user.xml', ); @@ -147,20 +146,6 @@ class WebExtension extends LoaderExtension return $configuration; } - public function debugLoad($config) - { - $configuration = new BuilderConfiguration(); - - if (isset($config['toolbar']) && $config['toolbar']) - { - $loader = new XmlFileLoader(__DIR__.'/../Resources/config'); - $configuration->merge($loader->load('debug_data_collector.xml')); - $configuration->merge($loader->load('debug_web_debug_toolbar.xml')); - } - - return $configuration; - } - /** * Returns the base path for the XSD files. * diff --git a/src/Symfony/Framework/WebBundle/Resources/config/debug_data_collector.xml b/src/Symfony/Framework/WebBundle/Resources/config/debug_data_collector.xml deleted file mode 100644 index ae8177ad3e..0000000000 --- a/src/Symfony/Framework/WebBundle/Resources/config/debug_data_collector.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - Symfony\Framework\WebBundle\Debug\DataCollector\DataCollectorManager - 86400 - Symfony\Framework\WebBundle\Debug\DataCollector\ConfigDataCollector - Symfony\Framework\WebBundle\Debug\DataCollector\AppDataCollector - Symfony\Framework\WebBundle\Debug\DataCollector\TimerDataCollector - Symfony\Framework\WebBundle\Debug\DataCollector\MemoryDataCollector - - - - - - - %debug.data_collector_manager.lifetime% - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Symfony/Framework/WebBundle/Resources/config/schema/dic/symfony/symfony-1.0.xsd b/src/Symfony/Framework/WebBundle/Resources/config/schema/dic/symfony/symfony-1.0.xsd index fc5e90fcfc..5afc3054ee 100644 --- a/src/Symfony/Framework/WebBundle/Resources/config/schema/dic/symfony/symfony-1.0.xsd +++ b/src/Symfony/Framework/WebBundle/Resources/config/schema/dic/symfony/symfony-1.0.xsd @@ -8,7 +8,6 @@ - @@ -45,8 +44,4 @@ - - - - diff --git a/src/Symfony/Framework/WebBundle/Resources/skeleton/application/xml/Kernel.php b/src/Symfony/Framework/WebBundle/Resources/skeleton/application/xml/Kernel.php index 301ccaeced..355a8fb7ed 100644 --- a/src/Symfony/Framework/WebBundle/Resources/skeleton/application/xml/Kernel.php +++ b/src/Symfony/Framework/WebBundle/Resources/skeleton/application/xml/Kernel.php @@ -16,7 +16,7 @@ class {{ class }}Kernel extends Kernel public function registerBundles() { - return array( + $bundles = array( new Symfony\Foundation\Bundle\KernelBundle(), new Symfony\Framework\WebBundle\Bundle(), @@ -27,6 +27,13 @@ class {{ class }}Kernel extends Kernel // register your bundles here ); + + if ($this->isDebug()) + { + $bundles[] = new Symfony\Framework\ProfilerBundle\Bundle(); + } + + return $bundles; } public function registerBundleDirs() diff --git a/src/Symfony/Framework/WebBundle/Resources/skeleton/application/xml/config/config_dev.xml b/src/Symfony/Framework/WebBundle/Resources/skeleton/application/xml/config/config_dev.xml index d99a32540b..5d90b62bc2 100644 --- a/src/Symfony/Framework/WebBundle/Resources/skeleton/application/xml/config/config_dev.xml +++ b/src/Symfony/Framework/WebBundle/Resources/skeleton/application/xml/config/config_dev.xml @@ -4,20 +4,21 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zend="http://www.symfony-project.org/schema/dic/zend" xmlns:web="http://www.symfony-project.org/schema/dic/symfony" - xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd"> + xmlns:profiler="http://www.symfony-project.org/schema/dic/symfony/profiler" + xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd + http://www.symfony-project.org/schema/dic/zend http://www.symfony-project.org/schema/dic/zend/zend-1.0.xsd + http://www.symfony-project.org/schema/dic/symfony/profiler http://www.symfony-project.org/schema/dic/symfony/profiler-1.0.xsd"> - diff --git a/src/Symfony/Framework/WebBundle/Resources/skeleton/application/yaml/Kernel.php b/src/Symfony/Framework/WebBundle/Resources/skeleton/application/yaml/Kernel.php index 41030fc063..52079b40ed 100644 --- a/src/Symfony/Framework/WebBundle/Resources/skeleton/application/yaml/Kernel.php +++ b/src/Symfony/Framework/WebBundle/Resources/skeleton/application/yaml/Kernel.php @@ -16,7 +16,7 @@ class {{ class }}Kernel extends Kernel public function registerBundles() { - return array( + $bundles = array( new Symfony\Foundation\Bundle\KernelBundle(), new Symfony\Framework\WebBundle\Bundle(), @@ -27,6 +27,13 @@ class {{ class }}Kernel extends Kernel // register your bundles here ); + + if ($this->isDebug()) + { + $bundles[] = new Symfony\Framework\ProfilerBundle\Bundle(); + } + + return $bundles; } public function registerBundleDirs() diff --git a/src/Symfony/Framework/WebBundle/Resources/skeleton/application/yaml/config/config_dev.yml b/src/Symfony/Framework/WebBundle/Resources/skeleton/application/yaml/config/config_dev.yml index b085aa941b..bdb5e013b2 100644 --- a/src/Symfony/Framework/WebBundle/Resources/skeleton/application/yaml/config/config_dev.yml +++ b/src/Symfony/Framework/WebBundle/Resources/skeleton/application/yaml/config/config_dev.yml @@ -5,7 +5,5 @@ zend.logger: priority: debug path: %kernel.logs_dir%/%kernel.environment%.log -web.debug: - exception: %kernel.debug% - toolbar: %kernel.debug% - ide: textmate +profiler.config: + toolbar: true