aboutsummaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/DoctrineMigrations/Version20190129120000.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20190129120000.php b/app/DoctrineMigrations/Version20190129120000.php
new file mode 100644
index 00000000..61e0ef4c
--- /dev/null
+++ b/app/DoctrineMigrations/Version20190129120000.php
@@ -0,0 +1,74 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Add missing entries in craue_config_setting.
10 */
11class Version20190129120000 extends WallabagMigration
12{
13 var $settings = array(
14 array("name" => "carrot", "value" => "1", "section" => "entry"),
15 array("name" => "share_diaspora", "value" => "1", "section" => "entry"),
16 array("name" => "diaspora_url", "value" => "http://diasporapod.com", "section" => "entry"),
17 array("name" => "share_shaarli", "value" => "1", "section" => "entry"),
18 array("name" => "shaarli_url", "value" => "http://myshaarli.com", "section" => "entry"),
19 array("name" => "share_mail", "value" => "1", "section" => "entry"),
20 array("name" => "share_twitter", "value" => "1", "section" => "entry"),
21 array("name" => "show_printlink", "value" => "1", "section" => "entry"),
22 array("name" => "export_epub", "value" => "1", "section" => "export"),
23 array("name" => "export_mobi", "value" => "1", "section" => "export"),
24 array("name" => "export_pdf", "value" => "1", "section" => "export"),
25 array("name" => "export_csv", "value" => "1", "section" => "export"),
26 array("name" => "export_json", "value" => "1", "section" => "export"),
27 array("name" => "export_txt", "value" => "1", "section" => "export"),
28 array("name" => "export_xml", "value" => "1", "section" => "export"),
29 array("name" => "piwik_enabled", "value" => "0", "section" => "analytics"),
30 array("name" => "piwik_host", "value" => "v2.wallabag.org", "section" => "analytics"),
31 array("name" => "piwik_site_id", "value" => "1", "section" => "analytics"),
32 array("name" => "demo_mode_enabled", "value" => "0", "section" => "misc"),
33 array("name" => "demo_mode_username", "value" => "wallabag", "section" => "misc"),
34 array("name" => "wallabag_support_url", "value" => "https://www.wallabag.org/pages/support.html", "section" => "misc"),
35 );
36
37 /**
38 * @param Schema $schema
39 */
40 public function up(Schema $schema)
41 {
42 $piwikEnabled = $this->container
43 ->get('doctrine.orm.default_entity_manager')
44 ->getConnection()
45 ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'piwik_enabled'");
46
47 $this->skipIf(false !== $piwikEnabled, 'It seems that you already played this migration, or user the wallabag:install command.');
48
49 foreach ($this->settings as $setting) {
50 $this->addSql("
51 INSERT INTO " . $this->getTable('craue_config_setting') . "
52 (name, value, section)
53 VALUES (
54 '" . $setting['name'] . "',
55 '" . $setting['value'] . "',
56 '" . $setting['section'] . "'
57 );
58 ");
59 }
60 }
61
62 /**
63 * @param Schema $schema
64 */
65 public function down(Schema $schema)
66 {
67 foreach ($this->settings as $setting) {
68 $this->addSql("
69 DELETE FROM " . $this->getTable('craue_config_setting') . "
70 WHERE name = '" . $setting['name'] . "';
71 ");
72 }
73 }
74}