1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-15 19:42:08 +00:00
This commit is contained in:
Nicolas Lœuillet 2025-08-26 20:31:11 +02:00 committed by GitHub
commit ad40dfe544
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 332 additions and 3 deletions

View file

@ -0,0 +1,106 @@
<?php
declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\Doctrine\WallabagMigration;
/**
* Add setting to enable or disable each importer.
*/
final class Version20250526113708 extends WallabagMigration
{
private $settings = [
[
'name' => 'pocket_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'wallabag_v1_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'wallabag_v2_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'elcura_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'readability_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'instapaper_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'pinboard_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'delicious_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'omnivore_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'firefox_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'chrome_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'shaarli_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'pocket_html_enabled',
'value' => '1',
'section' => 'import',
],
[
'name' => 'pocket_csv_enabled',
'value' => '1',
'section' => 'import',
],
];
public function up(Schema $schema): void
{
foreach ($this->settings as $setting) {
$settingEnabled = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('internal_setting') . " WHERE name = '" . $setting['name'] . "'");
if (false !== $settingEnabled) {
continue;
}
$this->addSql('INSERT INTO ' . $this->getTable('internal_setting') . " (name, value, section) VALUES ('" . $setting['name'] . "', '" . $setting['value'] . "', '" . $setting['section'] . "');");
}
}
public function down(Schema $schema): void
{
$this->skipIf(true, 'These settings are required and should not be removed.');
}
}