aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php90
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php113
2 files changed, 203 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 7a7e3a64..f6c85cf9 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -12,6 +12,7 @@ use Symfony\Component\Console\Output\OutputInterface;
12use Symfony\Component\Console\Question\ConfirmationQuestion; 12use Symfony\Component\Console\Question\ConfirmationQuestion;
13use Symfony\Component\Console\Question\Question; 13use Symfony\Component\Console\Question\Question;
14use Wallabag\CoreBundle\Entity\Config; 14use Wallabag\CoreBundle\Entity\Config;
15use Craue\ConfigBundle\Entity\Setting;
15 16
16class InstallCommand extends ContainerAwareCommand 17class InstallCommand extends ContainerAwareCommand
17{ 18{
@@ -212,6 +213,95 @@ class InstallCommand extends ContainerAwareCommand
212 213
213 $em->persist($config); 214 $em->persist($config);
214 215
216 // cleanup before insert new stuff
217 $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute();
218
219 $settings = [
220 [
221 'name' => 'download_pictures',
222 'value' => '1',
223 'section' => 'entry',
224 ],
225 [
226 'name' => 'carrot',
227 'value' => '1',
228 'section' => 'entry',
229 ],
230 [
231 'name' => 'share_diaspora',
232 'value' => '1',
233 'section' => 'entry',
234 ],
235 [
236 'name' => 'diaspora_url',
237 'value' => 'http://diasporapod.com',
238 'section' => 'entry',
239 ],
240 [
241 'name' => 'share_shaarli',
242 'value' => '1',
243 'section' => 'entry',
244 ],
245 [
246 'name' => 'shaarli_url',
247 'value' => 'http://myshaarli.com',
248 'section' => 'entry',
249 ],
250 [
251 'name' => 'share_mail',
252 'value' => '1',
253 'section' => 'entry',
254 ],
255 [
256 'name' => 'share_twitter',
257 'value' => '1',
258 'section' => 'entry',
259 ],
260 [
261 'name' => 'export_epub',
262 'value' => '1',
263 'section' => 'export',
264 ],
265 [
266 'name' => 'export_mobi',
267 'value' => '1',
268 'section' => 'export',
269 ],
270 [
271 'name' => 'export_pdf',
272 'value' => '1',
273 'section' => 'export',
274 ],
275 [
276 'name' => 'pocket_consumer_key',
277 'value' => NULL,
278 'section' => 'import',
279 ],
280 [
281 'name' => 'show_printlink',
282 'value' => '1',
283 'section' => 'entry',
284 ],
285 [
286 'name' => 'wallabag_support_url',
287 'value' => 'https://www.wallabag.org/pages/support.html',
288 'section' => 'misc',
289 ],
290 [
291 'name' => 'wallabag_url',
292 'value' => 'http://v2.wallabag.org',
293 'section' => 'misc',
294 ],
295 ];
296
297 foreach ($settings as $setting) {
298 $newSetting = new Setting();
299 $newSetting->setName($setting['name']);
300 $newSetting->setValue($setting['value']);
301 $newSetting->setSection($setting['section']);
302 $em->persist($newSetting);
303 }
304
215 $em->flush(); 305 $em->flush();
216 306
217 $this->defaultOutput->writeln(''); 307 $this->defaultOutput->writeln('');
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
new file mode 100644
index 00000000..863d28f5
--- /dev/null
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
@@ -0,0 +1,113 @@
1<?php
2
3namespace Wallabag\CoreBundle\DataFixtures\ORM;
4
5use Doctrine\Common\DataFixtures\AbstractFixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager;
8use Craue\ConfigBundle\Entity\Setting;
9
10class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
11{
12 /**
13 * {@inheritdoc}
14 */
15 public function load(ObjectManager $manager)
16 {
17 $settings = [
18 [
19 'name' => 'download_pictures',
20 'value' => '1',
21 'section' => 'entry',
22 ],
23 [
24 'name' => 'carrot',
25 'value' => '1',
26 'section' => 'entry',
27 ],
28 [
29 'name' => 'share_diaspora',
30 'value' => '1',
31 'section' => 'entry',
32 ],
33 [
34 'name' => 'diaspora_url',
35 'value' => 'http://diasporapod.com',
36 'section' => 'entry',
37 ],
38 [
39 'name' => 'share_shaarli',
40 'value' => '1',
41 'section' => 'entry',
42 ],
43 [
44 'name' => 'shaarli_url',
45 'value' => 'http://myshaarli.com',
46 'section' => 'entry',
47 ],
48 [
49 'name' => 'share_mail',
50 'value' => '1',
51 'section' => 'entry',
52 ],
53 [
54 'name' => 'share_twitter',
55 'value' => '1',
56 'section' => 'entry',
57 ],
58 [
59 'name' => 'export_epub',
60 'value' => '1',
61 'section' => 'export',
62 ],
63 [
64 'name' => 'export_mobi',
65 'value' => '1',
66 'section' => 'export',
67 ],
68 [
69 'name' => 'export_pdf',
70 'value' => '1',
71 'section' => 'export',
72 ],
73 [
74 'name' => 'pocket_consumer_key',
75 'value' => NULL,
76 'section' => 'import',
77 ],
78 [
79 'name' => 'show_printlink',
80 'value' => '1',
81 'section' => 'entry',
82 ],
83 [
84 'name' => 'wallabag_support_url',
85 'value' => 'https://www.wallabag.org/pages/support.html',
86 'section' => 'misc',
87 ],
88 [
89 'name' => 'wallabag_url',
90 'value' => 'http://v2.wallabag.org',
91 'section' => 'misc',
92 ],
93 ];
94
95 foreach ($settings as $setting) {
96 $newSetting = new Setting();
97 $newSetting->setName($setting['name']);
98 $newSetting->setValue($setting['value']);
99 $newSetting->setSection($setting['section']);
100 $manager->persist($newSetting);
101 }
102
103 $manager->flush();
104 }
105
106 /**
107 * {@inheritdoc}
108 */
109 public function getOrder()
110 {
111 return 50;
112 }
113}