diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-20 19:54:57 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-31 14:37:19 +0100 |
commit | bc78968764c741019a6b866ad434678cdbecbba4 (patch) | |
tree | 2b0ef3a4dcb51f09c7865a13b797221fadb445ae /src | |
parent | feb02cb709b7f72330fabcac2f81d0fabdbf1a9b (diff) | |
download | wallabag-bc78968764c741019a6b866ad434678cdbecbba4.tar.gz wallabag-bc78968764c741019a6b866ad434678cdbecbba4.tar.zst wallabag-bc78968764c741019a6b866ad434678cdbecbba4.zip |
Move default configuration out of parameters
These default configuration value shouldn't be in parameters.yml.
Diffstat (limited to 'src')
5 files changed, 29 insertions, 12 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index da099a19..7a7e3a64 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -205,10 +205,10 @@ class InstallCommand extends ContainerAwareCommand | |||
205 | $em->persist($user); | 205 | $em->persist($user); |
206 | 206 | ||
207 | $config = new Config($user); | 207 | $config = new Config($user); |
208 | $config->setTheme($this->getContainer()->getParameter('theme')); | 208 | $config->setTheme($this->getContainer()->getParameter('wallabag_core.theme')); |
209 | $config->setItemsPerPage($this->getContainer()->getParameter('items_on_page')); | 209 | $config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page')); |
210 | $config->setRssLimit($this->getContainer()->getParameter('rss_limit')); | 210 | $config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit')); |
211 | $config->setLanguage($this->getContainer()->getParameter('language')); | 211 | $config->setLanguage($this->getContainer()->getParameter('wallabag_core.language')); |
212 | 212 | ||
213 | $em->persist($config); | 213 | $em->persist($config); |
214 | 214 | ||
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 6c375909..4ece6431 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -133,10 +133,10 @@ class ConfigController extends Controller | |||
133 | $userManager->updateUser($newUser, true); | 133 | $userManager->updateUser($newUser, true); |
134 | 134 | ||
135 | $config = new Config($newUser); | 135 | $config = new Config($newUser); |
136 | $config->setTheme($this->container->getParameter('theme')); | 136 | $config->setTheme($this->container->getParameter('wallabag_core.theme')); |
137 | $config->setItemsPerPage($this->container->getParameter('items_on_page')); | 137 | $config->setItemsPerPage($this->container->getParameter('wallabag_core.items_on_page')); |
138 | $config->setRssLimit($this->container->getParameter('rss_limit')); | 138 | $config->setRssLimit($this->container->getParameter('wallabag_core.rss_limit')); |
139 | $config->setLanguage($this->container->getParameter('language')); | 139 | $config->setLanguage($this->container->getParameter('wallabag_core.language')); |
140 | 140 | ||
141 | $em->persist($config); | 141 | $em->persist($config); |
142 | 142 | ||
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php index 32acd1f1..4d5a63f8 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php | |||
@@ -17,6 +17,18 @@ class Configuration implements ConfigurationInterface | |||
17 | ->arrayNode('languages') | 17 | ->arrayNode('languages') |
18 | ->prototype('scalar')->end() | 18 | ->prototype('scalar')->end() |
19 | ->end() | 19 | ->end() |
20 | ->integerNode('items_on_page') | ||
21 | ->defaultValue(12) | ||
22 | ->end() | ||
23 | ->scalarNode('theme') | ||
24 | ->defaultValue('material') | ||
25 | ->end() | ||
26 | ->scalarNode('language') | ||
27 | ->defaultValue('en') | ||
28 | ->end() | ||
29 | ->integerNode('rss_limit') | ||
30 | ->defaultValue(50) | ||
31 | ->end() | ||
20 | ->end() | 32 | ->end() |
21 | ; | 33 | ; |
22 | 34 | ||
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php index 9ff9b732..73bbffe1 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php | |||
@@ -13,7 +13,12 @@ class WallabagCoreExtension extends Extension | |||
13 | { | 13 | { |
14 | $configuration = new Configuration(); | 14 | $configuration = new Configuration(); |
15 | $config = $this->processConfiguration($configuration, $configs); | 15 | $config = $this->processConfiguration($configuration, $configs); |
16 | |||
16 | $container->setParameter('wallabag_core.languages', $config['languages']); | 17 | $container->setParameter('wallabag_core.languages', $config['languages']); |
18 | $container->setParameter('wallabag_core.items_on_page', $config['items_on_page']); | ||
19 | $container->setParameter('wallabag_core.theme', $config['theme']); | ||
20 | $container->setParameter('wallabag_core.language', $config['language']); | ||
21 | $container->setParameter('wallabag_core.rss_limit', $config['rss_limit']); | ||
17 | 22 | ||
18 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | 23 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
19 | $loader->load('services.yml'); | 24 | $loader->load('services.yml'); |
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 25d71cba..6a1afcc0 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -76,10 +76,10 @@ services: | |||
76 | class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener | 76 | class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener |
77 | arguments: | 77 | arguments: |
78 | - "@doctrine.orm.entity_manager" | 78 | - "@doctrine.orm.entity_manager" |
79 | - %theme% | 79 | - %wallabag_core.theme% |
80 | - %items_on_page% | 80 | - %wallabag_core.items_on_page% |
81 | - %rss_limit% | 81 | - %wallabag_core.rss_limit% |
82 | - %language% | 82 | - %wallabag_core.language% |
83 | tags: | 83 | tags: |
84 | - { name: kernel.event_subscriber } | 84 | - { name: kernel.event_subscriber } |
85 | 85 | ||