3 namespace Application\Migrations
;
5 use Doctrine\DBAL\Schema\Schema
;
6 use Wallabag\CoreBundle\Doctrine\WallabagMigration
;
9 * Add missing entries in craue_config_setting.
11 class Version20190129120000
extends WallabagMigration
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"),
38 * @param Schema $schema
40 public function up(Schema
$schema)
42 $piwikEnabled = $this->container
43 ->get('doctrine.orm.default_entity_manager')
45 ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'piwik_enabled'");
47 $this->skipIf(false !== $piwikEnabled, 'It seems that you already played this migration, or user the wallabag:install command.');
49 foreach ($this->settings
as $setting) {
51 INSERT INTO " . $this->getTable('craue_config_setting') . "
52 (name, value, section)
54 '" . $setting['name'] . "',
55 '" . $setting['value'] . "',
56 '" . $setting['section'] . "'
63 * @param Schema $schema
65 public function down(Schema
$schema)
67 foreach ($this->settings
as $setting) {
69 DELETE FROM " . $this->getTable('craue_config_setting') . "
70 WHERE name = '" . $setting['name'] . "';