2019-01-29 13:24:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Application\Migrations;
|
|
|
|
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
2024-02-19 00:30:12 +00:00
|
|
|
use Wallabag\Doctrine\WallabagMigration;
|
2019-01-29 13:24:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add missing entries in craue_config_setting.
|
|
|
|
*/
|
2019-02-27 12:39:17 +00:00
|
|
|
final class Version20190129120000 extends WallabagMigration
|
2019-01-29 13:24:38 +00:00
|
|
|
{
|
2019-02-27 12:39:17 +00:00
|
|
|
private $settings = [
|
|
|
|
[
|
|
|
|
'name' => 'carrot',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'entry',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'share_diaspora',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'entry',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'diaspora_url',
|
|
|
|
'value' => 'http://diasporapod.com',
|
|
|
|
'section' => 'entry',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'share_shaarli',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'entry',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'shaarli_url',
|
|
|
|
'value' => 'http://myshaarli.com',
|
|
|
|
'section' => 'entry',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'share_mail',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'entry',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'share_twitter',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'entry',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'show_printlink',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'entry',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'export_epub',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'export',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'export_mobi',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'export',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'export_pdf',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'export',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'export_csv',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'export',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'export_json',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'export',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'export_txt',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'export',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'export_xml',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'export',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'piwik_enabled',
|
|
|
|
'value' => '0',
|
|
|
|
'section' => 'analytics',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'piwik_host',
|
|
|
|
'value' => 'v2.wallabag.org',
|
|
|
|
'section' => 'analytics',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'piwik_site_id',
|
|
|
|
'value' => '1',
|
|
|
|
'section' => 'analytics',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'demo_mode_enabled',
|
|
|
|
'value' => '0',
|
|
|
|
'section' => 'misc',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'demo_mode_username',
|
|
|
|
'value' => 'wallabag',
|
|
|
|
'section' => 'misc',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'wallabag_support_url',
|
|
|
|
'value' => 'https://www.wallabag.org/pages/support.html',
|
|
|
|
'section' => 'misc',
|
|
|
|
],
|
|
|
|
];
|
2019-01-29 13:24:38 +00:00
|
|
|
|
2022-12-14 13:36:29 +00:00
|
|
|
public function up(Schema $schema): void
|
2019-01-29 13:24:38 +00:00
|
|
|
{
|
2019-02-27 12:39:17 +00:00
|
|
|
foreach ($this->settings as $setting) {
|
|
|
|
$settingEnabled = $this->container
|
|
|
|
->get('doctrine.orm.default_entity_manager')
|
|
|
|
->getConnection()
|
2022-12-14 13:36:29 +00:00
|
|
|
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'");
|
2019-01-29 13:24:38 +00:00
|
|
|
|
2019-02-27 12:39:17 +00:00
|
|
|
if (false !== $settingEnabled) {
|
|
|
|
continue;
|
|
|
|
}
|
2019-01-29 13:24:38 +00:00
|
|
|
|
2019-02-27 12:39:17 +00:00
|
|
|
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('" . $setting['name'] . "', '" . $setting['value'] . "', '" . $setting['section'] . "');");
|
2019-01-29 13:24:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-14 13:36:29 +00:00
|
|
|
public function down(Schema $schema): void
|
2019-01-29 13:24:38 +00:00
|
|
|
{
|
2019-03-01 19:26:51 +00:00
|
|
|
$this->skipIf(true, 'These settings are required and should not be removed.');
|
2019-01-29 13:24:38 +00:00
|
|
|
}
|
|
|
|
}
|