From 6552c84eecdb2b9e394242f6d1344c6113788541 Mon Sep 17 00:00:00 2001 From: Yassine Guedidi Date: Mon, 1 Jan 2024 17:04:08 +0100 Subject: [PATCH] Move Import configuration to Core --- app/config/wallabag.yml | 2 -- .../CoreBundle/DependencyInjection/Configuration.php | 5 +++++ .../DependencyInjection/WallabagCoreExtension.php | 2 ++ .../DependencyInjection/Configuration.php | 11 ----------- .../DependencyInjection/WallabagImportExtension.php | 4 ---- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/app/config/wallabag.yml b/app/config/wallabag.yml index ee4ba86f9..954fa7879 100644 --- a/app/config/wallabag.yml +++ b/app/config/wallabag.yml @@ -162,7 +162,5 @@ wallabag_core: - 'Montserrat' - 'OpenDyslexicRegular' - 'Oswald' - -wallabag_import: allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain', 'text/csv', 'text/html'] resource_dir: "%kernel.project_dir%/web/uploads/import" diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php index edb43795e..104799ced 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php @@ -75,6 +75,11 @@ class Configuration implements ConfigurationInterface ->arrayNode('fonts') ->prototype('scalar')->end() ->end() + ->arrayNode('allow_mimetypes') + ->prototype('scalar')->end() + ->end() + ->scalarNode('resource_dir') + ->end() ->end() ; diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php index 155f05372..6dfde41fb 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php @@ -30,6 +30,8 @@ class WallabagCoreExtension extends Extension $container->setParameter('wallabag_core.site_credentials.encryption_key_path', $config['encryption_key_path']); $container->setParameter('wallabag_core.default_ignore_origin_instance_rules', $config['default_ignore_origin_instance_rules']); $container->setParameter('wallabag_core.fonts', $config['fonts']); + $container->setParameter('wallabag_import.allow_mimetypes', $config['allow_mimetypes']); + $container->setParameter('wallabag_import.resource_dir', $config['resource_dir']); } public function getAlias() diff --git a/src/Wallabag/ImportBundle/DependencyInjection/Configuration.php b/src/Wallabag/ImportBundle/DependencyInjection/Configuration.php index 3694c863e..e9e893e1a 100644 --- a/src/Wallabag/ImportBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/ImportBundle/DependencyInjection/Configuration.php @@ -10,17 +10,6 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('wallabag_import'); - $rootNode = $treeBuilder->getRootNode(); - - $rootNode - ->children() - ->arrayNode('allow_mimetypes') - ->prototype('scalar')->end() - ->end() - ->scalarNode('resource_dir') - ->end() - ->end() - ; return $treeBuilder; } diff --git a/src/Wallabag/ImportBundle/DependencyInjection/WallabagImportExtension.php b/src/Wallabag/ImportBundle/DependencyInjection/WallabagImportExtension.php index 2aa7d26fa..199774c70 100644 --- a/src/Wallabag/ImportBundle/DependencyInjection/WallabagImportExtension.php +++ b/src/Wallabag/ImportBundle/DependencyInjection/WallabagImportExtension.php @@ -9,10 +9,6 @@ class WallabagImportExtension extends Extension { public function load(array $configs, ContainerBuilder $container) { - $configuration = new Configuration(); - $config = $this->processConfiguration($configuration, $configs); - $container->setParameter('wallabag_import.allow_mimetypes', $config['allow_mimetypes']); - $container->setParameter('wallabag_import.resource_dir', $config['resource_dir']); } public function getAlias()