From 1ce6dfe04dc7c0b654185ed67a0a75543d62b405 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 31 Oct 2013 11:21:26 +0100 Subject: [PATCH] explode master config file. Now each xml file file presents in master config is parse --- core/lib/Thelia/Config/Resources/command.xml | 21 ++ core/lib/Thelia/Config/Resources/config.xml | 298 ------------------ core/lib/Thelia/Config/Resources/coupon.xml | 55 ++++ core/lib/Thelia/Config/Resources/form.xml | 125 ++++++++ core/lib/Thelia/Config/Resources/loop.xml | 59 ++++ .../Thelia/Config/Resources/smarty-plugin.xml | 100 ++++++ .../Compiler/TranslatorPass.php | 56 ++++ core/lib/Thelia/Core/Thelia.php | 13 +- 8 files changed, 426 insertions(+), 301 deletions(-) create mode 100644 core/lib/Thelia/Config/Resources/command.xml create mode 100644 core/lib/Thelia/Config/Resources/coupon.xml create mode 100644 core/lib/Thelia/Config/Resources/form.xml create mode 100644 core/lib/Thelia/Config/Resources/loop.xml create mode 100644 core/lib/Thelia/Config/Resources/smarty-plugin.xml create mode 100644 core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php diff --git a/core/lib/Thelia/Config/Resources/command.xml b/core/lib/Thelia/Config/Resources/command.xml new file mode 100644 index 000000000..308a1c50c --- /dev/null +++ b/core/lib/Thelia/Config/Resources/command.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 5574d07bc..e75ab8ebb 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -4,188 +4,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -238,83 +56,6 @@ - - - - - %kernel.environment% - - - - - - - - - - - - - - - - %thelia.parser.loops% - - - - - - - - - - - - - - - %thelia.parser.forms% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -328,45 +69,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core/lib/Thelia/Config/Resources/coupon.xml b/core/lib/Thelia/Config/Resources/coupon.xml new file mode 100644 index 000000000..fc327911c --- /dev/null +++ b/core/lib/Thelia/Config/Resources/coupon.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/lib/Thelia/Config/Resources/form.xml b/core/lib/Thelia/Config/Resources/form.xml new file mode 100644 index 000000000..8577bf145 --- /dev/null +++ b/core/lib/Thelia/Config/Resources/form.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/lib/Thelia/Config/Resources/loop.xml b/core/lib/Thelia/Config/Resources/loop.xml new file mode 100644 index 000000000..fe2c333d4 --- /dev/null +++ b/core/lib/Thelia/Config/Resources/loop.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/lib/Thelia/Config/Resources/smarty-plugin.xml b/core/lib/Thelia/Config/Resources/smarty-plugin.xml new file mode 100644 index 000000000..0d0b7ed15 --- /dev/null +++ b/core/lib/Thelia/Config/Resources/smarty-plugin.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + %kernel.environment% + + + + + + + + + + + + + + + + %thelia.parser.loops% + + + + + + + + + + + + + + + %thelia.parser.forms% + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php new file mode 100644 index 000000000..3bd35bb62 --- /dev/null +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php @@ -0,0 +1,56 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\DependencyInjection\Compiler; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + + +/** + * Class TranslatorPass + * @package Thelia\Core\DependencyInjection\Compiler + * @author Manuel Raynaud + */ +class TranslatorPass implements CompilerPassInterface +{ + + /** + * You can modify the container here before it is dumped to PHP code. + * + * @param ContainerBuilder $container + * + * @api + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition('thelia.translator')) { + return; + } + + $translator = $container->getDefinition('thelia.translator'); + + foreach($container->findTaggedServiceIds('translator.loader') as $id => $attributes) { + + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index 1bc1e7649..9b0d1402f 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -35,6 +35,7 @@ namespace Thelia\Core; use Propel\Runtime\Connection\ConnectionWrapper; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\Finder\Finder; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Yaml\Yaml; @@ -110,9 +111,15 @@ class Thelia extends Kernel { $loader = new XmlFileLoader($container, new FileLocator(THELIA_ROOT . "/core/lib/Thelia/Config/Resources")); - $loader->load("config.xml"); - $loader->load("routing.xml"); - $loader->load("action.xml"); + $finder = Finder::create() + ->name('*.xml') + ->depth(0) + ->in(THELIA_ROOT . "/core/lib/Thelia/Config/Resources"); + + foreach($finder as $file) { + $loader->load($file->getBaseName()); + } + if (defined("THELIA_INSTALL_MODE") === false) { $modules = \Thelia\Model\ModuleQuery::getActivated();