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 | |
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.
-rw-r--r-- | app/config/config.yml | 4 | ||||
-rw-r--r-- | app/config/parameters.yml.dist | 7 | ||||
-rw-r--r-- | app/config/tests/parameters.yml.dist.mysql | 7 | ||||
-rw-r--r-- | app/config/tests/parameters.yml.dist.pgsql | 7 | ||||
-rw-r--r-- | app/config/tests/parameters.yml.dist.sqlite | 7 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Command/InstallCommand.php | 8 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/ConfigController.php | 8 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/DependencyInjection/Configuration.php | 12 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php | 5 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/config/services.yml | 8 |
10 files changed, 33 insertions, 40 deletions
diff --git a/app/config/config.yml b/app/config/config.yml index a6cfc67d..943365e8 100644 --- a/app/config/config.yml +++ b/app/config/config.yml | |||
@@ -33,6 +33,10 @@ wallabag_core: | |||
33 | fr: 'Français' | 33 | fr: 'Français' |
34 | de: 'Deutsch' | 34 | de: 'Deutsch' |
35 | tr: 'Türkçe' | 35 | tr: 'Türkçe' |
36 | items_on_page: 12 | ||
37 | theme: material | ||
38 | language: en | ||
39 | rss_limit: 50 | ||
36 | 40 | ||
37 | wallabag_import: | 41 | wallabag_import: |
38 | allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain'] | 42 | allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain'] |
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index e4fcbd74..f9555676 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist | |||
@@ -68,12 +68,5 @@ parameters: | |||
68 | wallabag_url: http://v2.wallabag.org | 68 | wallabag_url: http://v2.wallabag.org |
69 | wallabag_support_url: 'https://www.wallabag.org/pages/support.html' | 69 | wallabag_support_url: 'https://www.wallabag.org/pages/support.html' |
70 | 70 | ||
71 | # default user config | ||
72 | items_on_page: 12 | ||
73 | theme: material | ||
74 | language: en | ||
75 | from_email: no-reply@wallabag.org | ||
76 | rss_limit: 50 | ||
77 | |||
78 | # pocket import | 71 | # pocket import |
79 | pocket_consumer_key: xxxxxxxx | 72 | pocket_consumer_key: xxxxxxxx |
diff --git a/app/config/tests/parameters.yml.dist.mysql b/app/config/tests/parameters.yml.dist.mysql index f902f239..e0e92760 100644 --- a/app/config/tests/parameters.yml.dist.mysql +++ b/app/config/tests/parameters.yml.dist.mysql | |||
@@ -58,12 +58,5 @@ parameters: | |||
58 | wallabag_url: http://v2.wallabag.org | 58 | wallabag_url: http://v2.wallabag.org |
59 | wallabag_support_url: 'https://www.wallabag.org/pages/support.html' | 59 | wallabag_support_url: 'https://www.wallabag.org/pages/support.html' |
60 | 60 | ||
61 | # default user config | ||
62 | items_on_page: 12 | ||
63 | theme: material | ||
64 | language: en_US | ||
65 | from_email: no-reply@wallabag.org | ||
66 | rss_limit: 50 | ||
67 | |||
68 | # pocket import | 61 | # pocket import |
69 | pocket_consumer_key: xxxxxxxx | 62 | pocket_consumer_key: xxxxxxxx |
diff --git a/app/config/tests/parameters.yml.dist.pgsql b/app/config/tests/parameters.yml.dist.pgsql index 76685b14..e6e7636c 100644 --- a/app/config/tests/parameters.yml.dist.pgsql +++ b/app/config/tests/parameters.yml.dist.pgsql | |||
@@ -58,12 +58,5 @@ parameters: | |||
58 | wallabag_url: http://v2.wallabag.org | 58 | wallabag_url: http://v2.wallabag.org |
59 | wallabag_support_url: 'https://www.wallabag.org/pages/support.html' | 59 | wallabag_support_url: 'https://www.wallabag.org/pages/support.html' |
60 | 60 | ||
61 | # default user config | ||
62 | items_on_page: 12 | ||
63 | theme: material | ||
64 | language: en_US | ||
65 | from_email: no-reply@wallabag.org | ||
66 | rss_limit: 50 | ||
67 | |||
68 | # pocket import | 61 | # pocket import |
69 | pocket_consumer_key: xxxxxxxx | 62 | pocket_consumer_key: xxxxxxxx |
diff --git a/app/config/tests/parameters.yml.dist.sqlite b/app/config/tests/parameters.yml.dist.sqlite index cdafb1b1..c47392a3 100644 --- a/app/config/tests/parameters.yml.dist.sqlite +++ b/app/config/tests/parameters.yml.dist.sqlite | |||
@@ -58,12 +58,5 @@ parameters: | |||
58 | wallabag_url: http://v2.wallabag.org | 58 | wallabag_url: http://v2.wallabag.org |
59 | wallabag_support_url: 'https://www.wallabag.org/pages/support.html' | 59 | wallabag_support_url: 'https://www.wallabag.org/pages/support.html' |
60 | 60 | ||
61 | # default user config | ||
62 | items_on_page: 12 | ||
63 | theme: material | ||
64 | language: en_US | ||
65 | from_email: no-reply@wallabag.org | ||
66 | rss_limit: 50 | ||
67 | |||
68 | # pocket import | 61 | # pocket import |
69 | pocket_consumer_key: xxxxxxxx | 62 | pocket_consumer_key: xxxxxxxx |
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 | ||