]> git.immae.eu Git - github/wallabag/wallabag.git/blob - app/DoctrineMigrations/Version20190129120000.php
Update deps
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20190129120000.php
1 <?php
2
3 namespace Application\Migrations;
4
5 use Doctrine\DBAL\Schema\Schema;
6 use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8 /**
9 * Add missing entries in craue_config_setting.
10 */
11 final class Version20190129120000 extends WallabagMigration
12 {
13 private $settings = [
14 [
15 'name' => 'carrot',
16 'value' => '1',
17 'section' => 'entry',
18 ],
19 [
20 'name' => 'share_diaspora',
21 'value' => '1',
22 'section' => 'entry',
23 ],
24 [
25 'name' => 'diaspora_url',
26 'value' => 'http://diasporapod.com',
27 'section' => 'entry',
28 ],
29 [
30 'name' => 'share_shaarli',
31 'value' => '1',
32 'section' => 'entry',
33 ],
34 [
35 'name' => 'shaarli_url',
36 'value' => 'http://myshaarli.com',
37 'section' => 'entry',
38 ],
39 [
40 'name' => 'share_mail',
41 'value' => '1',
42 'section' => 'entry',
43 ],
44 [
45 'name' => 'share_twitter',
46 'value' => '1',
47 'section' => 'entry',
48 ],
49 [
50 'name' => 'show_printlink',
51 'value' => '1',
52 'section' => 'entry',
53 ],
54 [
55 'name' => 'export_epub',
56 'value' => '1',
57 'section' => 'export',
58 ],
59 [
60 'name' => 'export_mobi',
61 'value' => '1',
62 'section' => 'export',
63 ],
64 [
65 'name' => 'export_pdf',
66 'value' => '1',
67 'section' => 'export',
68 ],
69 [
70 'name' => 'export_csv',
71 'value' => '1',
72 'section' => 'export',
73 ],
74 [
75 'name' => 'export_json',
76 'value' => '1',
77 'section' => 'export',
78 ],
79 [
80 'name' => 'export_txt',
81 'value' => '1',
82 'section' => 'export',
83 ],
84 [
85 'name' => 'export_xml',
86 'value' => '1',
87 'section' => 'export',
88 ],
89 [
90 'name' => 'piwik_enabled',
91 'value' => '0',
92 'section' => 'analytics',
93 ],
94 [
95 'name' => 'piwik_host',
96 'value' => 'v2.wallabag.org',
97 'section' => 'analytics',
98 ],
99 [
100 'name' => 'piwik_site_id',
101 'value' => '1',
102 'section' => 'analytics',
103 ],
104 [
105 'name' => 'demo_mode_enabled',
106 'value' => '0',
107 'section' => 'misc',
108 ],
109 [
110 'name' => 'demo_mode_username',
111 'value' => 'wallabag',
112 'section' => 'misc',
113 ],
114 [
115 'name' => 'wallabag_support_url',
116 'value' => 'https://www.wallabag.org/pages/support.html',
117 'section' => 'misc',
118 ],
119 ];
120
121 public function up(Schema $schema)
122 {
123 foreach ($this->settings as $setting) {
124 $settingEnabled = $this->container
125 ->get('doctrine.orm.default_entity_manager')
126 ->getConnection()
127 ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'");
128
129 if (false !== $settingEnabled) {
130 continue;
131 }
132
133 $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('" . $setting['name'] . "', '" . $setting['value'] . "', '" . $setting['section'] . "');");
134 }
135 }
136
137 public function down(Schema $schema)
138 {
139 $this->skipIf(true, 'These settings are required and should not be removed.');
140 }
141 }