From 7975395d10bb381de8cd15b5ee15198318af6d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Viande?= Date: Wed, 11 Apr 2018 11:42:52 +0200 Subject: Entry: add archived_at property and updateArchived method --- app/DoctrineMigrations/Version20180405182455.php | 68 ++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 app/DoctrineMigrations/Version20180405182455.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20180405182455.php b/app/DoctrineMigrations/Version20180405182455.php new file mode 100755 index 00000000..71879c0e --- /dev/null +++ b/app/DoctrineMigrations/Version20180405182455.php @@ -0,0 +1,68 @@ +container = $container; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf($entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.'); + + $entryTable->addColumn('archived_at', 'datetime', [ + 'notnull' => false, + ]); + } + + public function postUp(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + $this->skipIf(!$entryTable->hasColumn('archived_at'), 'Unable to add archived_at colum'); + + $this->connection->executeQuery( + 'UPDATE ' . $this->getTable('entry') . ' SET archived_at = updated_at WHERE is_archived = :is_archived', + [ + 'is_archived' => true, + ] + ); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf(!$entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.'); + + $entryTable->dropColumn('archived_at'); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } +} -- cgit v1.2.3 From 9b0aef9171389aa9cdc39e8434df0f912ee5bdae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20HULARD?= Date: Wed, 24 Jan 2018 17:29:26 +0100 Subject: Update tag list template to allow renaming. * Add a form on each tag to handle rename action. * Add JavaScript to handle action on the corresponding page inside the global index.js file. * Add support for the 2 active themes : material / baggy The form solution is cleaner than an Ajax one because it let the browser validate input data and make the POST easier without the need to handle JSON response. --- app/Resources/static/themes/_global/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'app') diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js index ae598e56..bb3e95b6 100644 --- a/app/Resources/static/themes/_global/index.js +++ b/app/Resources/static/themes/_global/index.js @@ -70,4 +70,23 @@ $(document).ready(() => { retrievePercent(x.entryId, true); }); } + + document.querySelectorAll('[data-handler=tag-rename]').forEach((item) => { + const current = item; + current.wallabag_edit_mode = false; + current.onclick = (event) => { + const target = event.currentTarget; + + if (target.wallabag_edit_mode === false) { + $(target.parentNode.querySelector('[data-handle=tag-link]')).addClass('hidden'); + $(target.parentNode.querySelector('[data-handle=tag-rename-form]')).removeClass('hidden'); + target.parentNode.querySelector('[data-handle=tag-rename-form] input').focus(); + target.querySelector('.material-icons').innerHTML = 'done'; + + target.wallabag_edit_mode = true; + } else { + target.parentNode.querySelector('[data-handle=tag-rename-form]').submit(); + } + }; + }); }); -- cgit v1.2.3 From 32968bd30e907dcb681831c149a9afcc12a664da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20HULARD?= Date: Wed, 24 Jan 2018 17:30:06 +0100 Subject: Add specific styles for the card tag form element. Also add a `.hidden` class in the baggy theme to have consistency with material. --- app/Resources/static/themes/baggy/css/layout.scss | 11 ++++++++++- app/Resources/static/themes/material/css/cards.scss | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/Resources/static/themes/baggy/css/layout.scss b/app/Resources/static/themes/baggy/css/layout.scss index cb14e62d..0293ebe5 100644 --- a/app/Resources/static/themes/baggy/css/layout.scss +++ b/app/Resources/static/themes/baggy/css/layout.scss @@ -295,6 +295,15 @@ div.pagination ul { } } -.hide { +.card-tag-form { + display: inline-block; +} + +.card-tag-form input[type="text"] { + min-width: 20em; +} + +.hide, +.hidden { display: none; } diff --git a/app/Resources/static/themes/material/css/cards.scss b/app/Resources/static/themes/material/css/cards.scss index 8f7f8f7b..f3319f3d 100644 --- a/app/Resources/static/themes/material/css/cards.scss +++ b/app/Resources/static/themes/material/css/cards.scss @@ -180,6 +180,17 @@ a.original:not(.waves-effect) { flex-grow: 1; } +.card-tag-form { + display: flex; + min-width: 100px; + flex-grow: 1; +} + +.card-tag-form input { + margin-bottom: 0; + height: 2rem; +} + .card-tag-rss { display: flex; } -- cgit v1.2.3 From 115de64e5bb9d7f9151ecf15e15a0d988563528e Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 4 Oct 2018 14:07:20 +0200 Subject: Jump to Symfony 3.4 Thanks to the BC compatibility, almost nothing have to be changed. All changes are related to new bundle version of: - SensioFrameworkExtraBundle - DoctrineFixturesBundle --- app/AppKernel.php | 2 +- app/config/config.yml | 5 +++++ app/config/config_test.yml | 1 + app/config/security.yml | 3 +++ app/config/services.yml | 6 ------ app/config/services_test.yml | 38 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 app/config/services_test.yml (limited to 'app') diff --git a/app/AppKernel.php b/app/AppKernel.php index 40726f05..546794de 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -32,6 +32,7 @@ class AppKernel extends Kernel new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new BD\GuzzleSiteAuthenticatorBundle\BDGuzzleSiteAuthenticatorBundle(), + new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(), // wallabag bundles new Wallabag\CoreBundle\WallabagCoreBundle(), @@ -39,7 +40,6 @@ class AppKernel extends Kernel new Wallabag\UserBundle\WallabagUserBundle(), new Wallabag\ImportBundle\WallabagImportBundle(), new Wallabag\AnnotationBundle\WallabagAnnotationBundle(), - new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(), ]; if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { diff --git a/app/config/config.yml b/app/config/config.yml index 0c2b6a1d..951cdf71 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -357,3 +357,8 @@ jms_serializer: # see: https://github.com/schmittjoh/JMSSerializerBundle/pull/494 datetime: default_format: "Y-m-d\\TH:i:sO" # ATOM + +# see https://github.com/symfony/symfony-standard/pull/1133 +sensio_framework_extra: + router: + annotations: false diff --git a/app/config/config_test.yml b/app/config/config_test.yml index fc067ff4..11e0feb7 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml @@ -1,6 +1,7 @@ imports: - { resource: config_dev.yml } - { resource: parameters_test.yml } + - { resource: services_test.yml } framework: test: ~ diff --git a/app/config/security.yml b/app/config/security.yml index 02afc9ea..98f43011 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -31,12 +31,15 @@ security: fos_oauth: true stateless: true anonymous: true + provider: fos_userbundle login_firewall: + logout_on_user_change: true pattern: ^/login$ anonymous: ~ secured_area: + logout_on_user_change: true pattern: ^/ form_login: provider: fos_userbundle diff --git a/app/config/services.yml b/app/config/services.yml index 7b85d846..25bbe5dc 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -2,12 +2,6 @@ parameters: lexik_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber services: - # used for tests - filesystem_cache: - class: Doctrine\Common\Cache\FilesystemCache - arguments: - - "%kernel.cache_dir%/doctrine/metadata" - twig.extension.text: class: Twig_Extensions_Extension_Text tags: diff --git a/app/config/services_test.yml b/app/config/services_test.yml new file mode 100644 index 00000000..a300f75d --- /dev/null +++ b/app/config/services_test.yml @@ -0,0 +1,38 @@ +services: + # see https://github.com/symfony/symfony/issues/24543 + fos_user.user_manager.test: + alias: fos_user.user_manager + public: true + + fos_user.security.login_manager.test: + alias: fos_user.security.login_manager + public: true + + wallabag_core.entry_repository.test: + alias: wallabag_core.entry_repository + public: true + + wallabag_user.user_repository.test: + alias: wallabag_user.user_repository + public: true + + filesystem_cache: + class: Doctrine\Common\Cache\FilesystemCache + arguments: + - "%kernel.cache_dir%/doctrine/metadata" + + # fixtures + Wallabag\AnnotationBundle\DataFixtures\ORM\: + resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/ORM/*' + tags: ['doctrine.fixture.orm'] + autowire: true + + Wallabag\CoreBundle\DataFixtures\ORM\: + resource: '../../src/Wallabag/CoreBundle/DataFixtures/ORM/*' + tags: ['doctrine.fixture.orm'] + autowire: true + + Wallabag\UserBundle\DataFixtures\ORM\: + resource: '../../src/Wallabag/UserBundle/DataFixtures/ORM/*' + tags: ['doctrine.fixture.orm'] + autowire: true -- cgit v1.2.3 From 6a3187066f2f60120acd11b207a40bbd6d6d9519 Mon Sep 17 00:00:00 2001 From: Glenn Goffin Date: Fri, 23 Feb 2018 20:39:25 +0100 Subject: Add secure email --- app/config/config.yml | 11 +++++++---- app/config/parameters.yml.dist | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/config/config.yml b/app/config/config.yml index 951cdf71..092f3ec0 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -79,10 +79,13 @@ doctrine_migrations: # Swiftmailer Configuration swiftmailer: - transport: "%mailer_transport%" - host: "%mailer_host%" - username: "%mailer_user%" - password: "%mailer_password%" + transport: "%mailer_transport%" + username: "%mailer_user%" + password: "%mailer_password%" + host: "%mailer_host%" + port: "%mailer_port%" + encryption: "%mailer_encryption%" + auth_mode: "%mailer_auth_mode%" spool: type: memory diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 6b0cb8e8..d21f20e0 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -27,10 +27,13 @@ parameters: domain_name: https://your-wallabag-url-instance.com - mailer_transport: smtp - mailer_host: 127.0.0.1 - mailer_user: ~ - mailer_password: ~ + mailer_transport: smtp + mailer_user: ~ + mailer_password: ~ + mailer_host: 127.0.0.1 + mailer_port: false + mailer_encryption: ~ + mailer_auth_mode: ~ locale: en -- cgit v1.2.3 From be417ef23685e17a239b1d192a0e9b9f484f1bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 12 Jun 2017 17:23:35 +0200 Subject: Added possibility to change locale from login/register pages --- app/config/security.yml | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/config/security.yml b/app/config/security.yml index 98f43011..0318fce1 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -64,6 +64,7 @@ security: - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: /(unread|starred|archive|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/locale, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/settings, roles: ROLE_SUPER_ADMIN } -- cgit v1.2.3 From 6fc95673df5349d682eb6ca6185f894eb711d13a Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 24 Oct 2018 21:02:35 +0200 Subject: Cleanup --- app/AppKernel.php | 22 +++++++++++++++++++--- app/autoload.php | 13 ------------- 2 files changed, 19 insertions(+), 16 deletions(-) delete mode 100644 app/autoload.php (limited to 'app') diff --git a/app/AppKernel.php b/app/AppKernel.php index 546794de..7d19e9ab 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -1,6 +1,7 @@ getEnvironment()) { $bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle(); } + + if ('dev' === $this->getEnvironment()) { + $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); + $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle(); + } } return $bundles; } + public function getRootDir() + { + return __DIR__; + } + public function getCacheDir() { return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); @@ -70,7 +79,8 @@ class AppKernel extends Kernel public function registerContainerConfiguration(LoaderInterface $loader) { - $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml'); + $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); + $loader->load(function ($container) { if ($container->getParameter('use_webpack_dev_server')) { $container->loadFromExtension('framework', [ @@ -86,5 +96,11 @@ class AppKernel extends Kernel ]); } }); + + $loader->load(function (ContainerBuilder $container) { + // $container->setParameter('container.autowiring.strict_mode', true); + // $container->setParameter('container.dumper.inline_class_loader', true); + $container->addObjectResource($this); + }); } } diff --git a/app/autoload.php b/app/autoload.php deleted file mode 100644 index c5f664dc..00000000 --- a/app/autoload.php +++ /dev/null @@ -1,13 +0,0 @@ - Date: Mon, 26 Nov 2018 20:00:01 +0100 Subject: Update fixtures --- app/config/services_test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/config/services_test.yml b/app/config/services_test.yml index a300f75d..1b3aff63 100644 --- a/app/config/services_test.yml +++ b/app/config/services_test.yml @@ -22,17 +22,17 @@ services: - "%kernel.cache_dir%/doctrine/metadata" # fixtures - Wallabag\AnnotationBundle\DataFixtures\ORM\: - resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/ORM/*' + Wallabag\UserBundle\DataFixtures\: + resource: '../../src/Wallabag/UserBundle/DataFixtures/*' tags: ['doctrine.fixture.orm'] autowire: true - Wallabag\CoreBundle\DataFixtures\ORM\: - resource: '../../src/Wallabag/CoreBundle/DataFixtures/ORM/*' + Wallabag\CoreBundle\DataFixtures\: + resource: '../../src/Wallabag/CoreBundle/DataFixtures/*' tags: ['doctrine.fixture.orm'] autowire: true - Wallabag\UserBundle\DataFixtures\ORM\: - resource: '../../src/Wallabag/UserBundle/DataFixtures/ORM/*' + Wallabag\AnnotationBundle\DataFixtures\: + resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/*' tags: ['doctrine.fixture.orm'] autowire: true -- cgit v1.2.3 From 1b6b77f02956a767fb3fa9825a7b97b4879f7d42 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 26 Nov 2018 20:02:15 +0100 Subject: Remove custom Postgres class Because PG > 10 is now supported by DBAL >= 2.6.0 --- app/config/config.yml | 1 - app/config/config_test.yml | 1 - app/config/parameters.yml.dist | 2 -- app/config/parameters_test.yml | 1 - app/config/tests/parameters_test.mysql.yml | 1 - app/config/tests/parameters_test.pgsql.yml | 1 - app/config/tests/parameters_test.sqlite.yml | 1 - 7 files changed, 8 deletions(-) (limited to 'app') diff --git a/app/config/config.yml b/app/config/config.yml index 092f3ec0..ee0f0a38 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -46,7 +46,6 @@ twig: doctrine: dbal: driver: "%database_driver%" - driver_class: "%database_driver_class%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" diff --git a/app/config/config_test.yml b/app/config/config_test.yml index 11e0feb7..216f8431 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml @@ -24,7 +24,6 @@ swiftmailer: doctrine: dbal: driver: "%test_database_driver%" - driver_class: "%test_database_driver_class%" host: "%test_database_host%" port: "%test_database_port%" dbname: "%test_database_name%" diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index d21f20e0..13e2584f 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -11,8 +11,6 @@ parameters: # database_password: %env.database_password% database_driver: pdo_mysql - database_driver_class: ~ - # database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver database_host: 127.0.0.1 database_port: ~ database_name: wallabag diff --git a/app/config/parameters_test.yml b/app/config/parameters_test.yml index 64e51976..257d2ace 100644 --- a/app/config/parameters_test.yml +++ b/app/config/parameters_test.yml @@ -8,4 +8,3 @@ parameters: test_database_path: "%env(TEST_DATABASE_PATH)%" env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite" test_database_charset: utf8 - test_database_driver_class: ~ diff --git a/app/config/tests/parameters_test.mysql.yml b/app/config/tests/parameters_test.mysql.yml index 0b7b82eb..36b227fb 100644 --- a/app/config/tests/parameters_test.mysql.yml +++ b/app/config/tests/parameters_test.mysql.yml @@ -1,6 +1,5 @@ parameters: test_database_driver: pdo_mysql - test_database_driver_class: ~ test_database_host: localhost test_database_port: 3306 test_database_name: wallabag_test diff --git a/app/config/tests/parameters_test.pgsql.yml b/app/config/tests/parameters_test.pgsql.yml index ea249324..60f51df6 100644 --- a/app/config/tests/parameters_test.pgsql.yml +++ b/app/config/tests/parameters_test.pgsql.yml @@ -1,6 +1,5 @@ parameters: test_database_driver: pdo_pgsql - test_database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver test_database_host: localhost test_database_port: test_database_name: wallabag_test diff --git a/app/config/tests/parameters_test.sqlite.yml b/app/config/tests/parameters_test.sqlite.yml index 64cd984b..2b92d579 100644 --- a/app/config/tests/parameters_test.sqlite.yml +++ b/app/config/tests/parameters_test.sqlite.yml @@ -1,6 +1,5 @@ parameters: test_database_driver: pdo_sqlite - test_database_driver_class: ~ test_database_host: localhost test_database_port: test_database_name: ~ -- cgit v1.2.3 From 877787e5fe6a6545105616968939949b4db81347 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 28 Nov 2018 20:26:18 +0100 Subject: Fix utf8mb4 on vendor tables When creating the schema for test these tables use default length for string: 255. Which fail when using utf8mb4. > Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Also move the `setKeepStaticConnections` in before and after class to avoid: > SAVEPOINT DOCTRINE2_SAVEPOINT_2 does not exist See https://github.com/dmaicher/doctrine-test-bundle#troubleshooting --- app/DoctrineMigrations/Version20180405182455.php | 21 ++--------- app/DoctrineMigrations/Version20181128203230.php | 45 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 app/DoctrineMigrations/Version20181128203230.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20180405182455.php b/app/DoctrineMigrations/Version20180405182455.php index 71879c0e..50fe97c7 100755 --- a/app/DoctrineMigrations/Version20180405182455.php +++ b/app/DoctrineMigrations/Version20180405182455.php @@ -2,26 +2,14 @@ namespace Application\Migrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** * Add archived_at column and set its value to updated_at for is_archived entries. */ -class Version20180405182455 extends AbstractMigration implements ContainerAwareInterface +class Version20180405182455 extends WallabagMigration { - /** - * @var ContainerInterface - */ - private $container; - - public function setContainer(ContainerInterface $container = null) - { - $this->container = $container; - } - /** * @param Schema $schema */ @@ -60,9 +48,4 @@ class Version20180405182455 extends AbstractMigration implements ContainerAwareI $entryTable->dropColumn('archived_at'); } - - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix') . $tableName; - } } diff --git a/app/DoctrineMigrations/Version20181128203230.php b/app/DoctrineMigrations/Version20181128203230.php new file mode 100644 index 00000000..d1b09fc7 --- /dev/null +++ b/app/DoctrineMigrations/Version20181128203230.php @@ -0,0 +1,45 @@ +skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)'); + } + + public function down(Schema $schema) + { + $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)'); + } +} -- cgit v1.2.3 From 3bd65991adc253715c6b74ab0ee19ff2cf3e6c69 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 15 Jan 2019 10:17:11 +0100 Subject: Add a new endpoint to retrieve information from the wallabag instance Useful for api client which required some information. We might add more inside them in the future. The endpoint /api/version should be avoided now as it contains not so much information rather the version. --- app/config/security.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'app') diff --git a/app/config/security.yml b/app/config/security.yml index 0318fce1..96489e26 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -57,9 +57,7 @@ security: target: / access_control: - - { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: ^/api/version, roles: IS_AUTHENTICATED_ANONYMOUSLY } - - { path: ^/api/user, roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/api/(doc|version|info|user), roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } -- cgit v1.2.3 From 1e0d8ad7b728f6fb2cd886526b0fb84ef803e84f Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 17 Jan 2019 14:28:05 +0100 Subject: Enable PHPStan - Fix error for level 0 & 1 (level 7 has 699 errors...) - Add `updated_at` to site_credential (so the `timestamps()` method applies correctly) --- app/DoctrineMigrations/Version20190117131816.php | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190117131816.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190117131816.php b/app/DoctrineMigrations/Version20190117131816.php new file mode 100644 index 00000000..6548b9fa --- /dev/null +++ b/app/DoctrineMigrations/Version20190117131816.php @@ -0,0 +1,32 @@ +getTable($this->getTable('site_credential')); + + $this->skipIf($siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.'); + + $siteCredentialTable->addColumn('updated_at', 'datetime', [ + 'notnull' => false, + ]); + } + + public function down(Schema $schema): void + { + $siteCredentialTable = $schema->getTable($this->getTable('site_credential')); + + $this->skipIf(!$siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.'); + + $siteCredentialTable->dropColumn('updated_at'); + } +} -- cgit v1.2.3 From 50f35f0db2be9586205e793f315608eec59c9666 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 19 Jan 2019 22:08:29 +0100 Subject: Move icon into the top menu bar Change the way to select a random entry: - select all ids from the given user (with filters) - choose randomly one in php - find that entry --- app/Resources/static/themes/material/index.js | 4 +++- app/Resources/static/themes/material/js/tools.js | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js index 96310d81..05794597 100755 --- a/app/Resources/static/themes/material/index.js +++ b/app/Resources/static/themes/material/index.js @@ -8,7 +8,7 @@ import 'materialize-css/dist/js/materialize'; import '../_global/index'; /* Tools */ -import { initExport, initFilters } from './js/tools'; +import { initExport, initFilters, initRandom } from './js/tools'; /* Import shortcuts */ import './js/shortcuts/main'; @@ -32,8 +32,10 @@ $(document).ready(() => { format: 'dd/mm/yyyy', container: 'body', }); + initFilters(); initExport(); + initRandom(); const toggleNav = (toShow, toFocus) => { $('.nav-panel-actions').hide(100); diff --git a/app/Resources/static/themes/material/js/tools.js b/app/Resources/static/themes/material/js/tools.js index 39398fd8..0b3d3038 100644 --- a/app/Resources/static/themes/material/js/tools.js +++ b/app/Resources/static/themes/material/js/tools.js @@ -8,6 +8,7 @@ function initFilters() { $('#clear_form_filters').on('click', () => { $('#filters input').val(''); $('#filters :checked').removeAttr('checked'); + return false; }); } @@ -21,4 +22,15 @@ function initExport() { } } -export { initExport, initFilters }; +function initRandom() { + // no display if export (ie: entries) not available + if ($('div').is('#export')) { + $('#button_random').show(); + } +} + +export { + initExport, + initFilters, + initRandom, +}; -- cgit v1.2.3 From 6113dbbc2037551ac11bab2c7cd1bb6f78676e0f Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 22 Jan 2019 20:38:28 +0100 Subject: Removed hardcoded database version --- app/config/config.yml | 1 - 1 file changed, 1 deletion(-) (limited to 'app') diff --git a/app/config/config.yml b/app/config/config.yml index ee0f0a38..4b34af30 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -54,7 +54,6 @@ doctrine: charset: "%database_charset%" path: "%database_path%" unix_socket: "%database_socket%" - server_version: 5.6 orm: auto_generate_proxy_classes: "%kernel.debug%" -- cgit v1.2.3 From a6b242a1fd6f8900d80354361449f1bf62506ef9 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 2 Dec 2018 12:43:05 +0100 Subject: Enable OTP 2FA - Update SchebTwoFactorBundle to version 3 - Enable Google 2fa on the bundle - Disallow ability to use both email and google as 2fa - Update Ocramius Proxy Manager to handle typed function & attributes (from PHP 7) - use `$this->addFlash` shortcut instead of `$this->get('session')->getFlashBag()->add` - update admin to be able to create/reset the 2fa --- app/DoctrineMigrations/Version20181202073750.php | 22 ++++++++++++++++++++++ app/Resources/static/themes/_global/index.js | 18 ++++++++++++++++++ app/Resources/static/themes/material/index.js | 5 +++++ app/config/config.yml | 8 ++++++-- app/config/routing.yml | 8 ++++++++ app/config/security.yml | 9 +++++++++ 6 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 app/DoctrineMigrations/Version20181202073750.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20181202073750.php b/app/DoctrineMigrations/Version20181202073750.php new file mode 100644 index 00000000..a2308b99 --- /dev/null +++ b/app/DoctrineMigrations/Version20181202073750.php @@ -0,0 +1,22 @@ +addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL, CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL, DROP trusted'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret, CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL, ADD trusted TEXT DEFAULT NULL'); + } +} diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js index bb3e95b6..9ad96fc0 100644 --- a/app/Resources/static/themes/_global/index.js +++ b/app/Resources/static/themes/_global/index.js @@ -89,4 +89,22 @@ $(document).ready(() => { } }; }); + + // mimic radio button because emailTwoFactor is a boolean + $('#update_user_googleTwoFactor').on('change', () => { + $('#update_user_emailTwoFactor').prop('checked', false); + }); + + $('#update_user_emailTwoFactor').on('change', () => { + $('#update_user_googleTwoFactor').prop('checked', false); + }); + + // same mimic for super admin + $('#user_googleTwoFactor').on('change', () => { + $('#user_emailTwoFactor').prop('checked', false); + }); + + $('#user_emailTwoFactor').on('change', () => { + $('#user_googleTwoFactor').prop('checked', false); + }); }); diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js index 05794597..2926cad1 100755 --- a/app/Resources/static/themes/material/index.js +++ b/app/Resources/static/themes/material/index.js @@ -50,25 +50,30 @@ $(document).ready(() => { $('#tag_label').focus(); return false; }); + $('#nav-btn-add').on('click', () => { toggleNav('.nav-panel-add', '#entry_url'); return false; }); + const materialAddForm = $('.nav-panel-add'); materialAddForm.on('submit', () => { materialAddForm.addClass('disabled'); $('input#entry_url', materialAddForm).prop('readonly', true).trigger('blur'); }); + $('#nav-btn-search').on('click', () => { toggleNav('.nav-panel-search', '#search_entry_term'); return false; }); + $('.close').on('click', (e) => { $(e.target).parent('.nav-panel-item').hide(100); $('.nav-panel-actions').show(100); $('.nav-panels').css('background', 'transparent'); return false; }); + $(window).scroll(() => { const s = $(window).scrollTop(); const d = $(document).height(); diff --git a/app/config/config.yml b/app/config/config.yml index 4b34af30..908f53b7 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -198,10 +198,14 @@ fos_oauth_server: refresh_token_lifetime: 1209600 scheb_two_factor: - trusted_computer: + trusted_device: enabled: true cookie_name: wllbg_trusted_computer - cookie_lifetime: 2592000 + lifetime: 2592000 + + google: + enabled: "%twofactor_auth%" + template: WallabagUserBundle:Authentication:form.html.twig email: enabled: "%twofactor_auth%" diff --git a/app/config/routing.yml b/app/config/routing.yml index 0bd2d130..a7c0f7e9 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -51,3 +51,11 @@ craue_config_settings_modify: fos_js_routing: resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml" + +2fa_login: + path: /2fa + defaults: + _controller: "scheb_two_factor.form_controller:form" + +2fa_login_check: + path: /2fa_check diff --git a/app/config/security.yml b/app/config/security.yml index 96489e26..6a21b4e5 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -56,9 +56,17 @@ security: path: /logout target: / + two_factor: + provider: fos_userbundle + auth_form_path: 2fa_login + check_path: 2fa_login_check + access_control: - { path: ^/api/(doc|version|info|user), roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } + # force role for logout otherwise when 2fa enable, you won't be able to logout + # https://github.com/scheb/two-factor-bundle/issues/168#issuecomment-430822478 + - { path: ^/logout, roles: [IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_2FA_IN_PROGRESS] } - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: /(unread|starred|archive|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } @@ -67,5 +75,6 @@ security: - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/settings, roles: ROLE_SUPER_ADMIN } - { path: ^/annotations, roles: ROLE_USER } + - { path: ^/2fa, role: IS_AUTHENTICATED_2FA_IN_PROGRESS } - { path: ^/users, roles: ROLE_SUPER_ADMIN } - { path: ^/, roles: ROLE_USER } -- cgit v1.2.3 From dfd0a7bc5feb4fd7b77d7e2f3a25c5c3febc1eba Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 3 Dec 2018 06:51:06 +0100 Subject: Add backup codes --- app/DoctrineMigrations/Version20181202073750.php | 22 ++++++++++++++++++++-- app/config/config.yml | 3 +++ 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20181202073750.php b/app/DoctrineMigrations/Version20181202073750.php index a2308b99..b6ad8bd7 100644 --- a/app/DoctrineMigrations/Version20181202073750.php +++ b/app/DoctrineMigrations/Version20181202073750.php @@ -12,11 +12,29 @@ final class Version20181202073750 extends WallabagMigration { public function up(Schema $schema): void { - $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL, CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL, DROP trusted'); + $tableName = $this->getTable('annotation'); + + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL, CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL, DROP trusted, ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\''); + break; + case 'postgresql': + break; + } } public function down(Schema $schema): void { - $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret, CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL, ADD trusted TEXT DEFAULT NULL'); + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + break; + case 'mysql': + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret, CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL, ADD trusted TEXT DEFAULT NULL, DROP backupCodes'); + break; + case 'postgresql': + break; + } } } diff --git a/app/config/config.yml b/app/config/config.yml index 908f53b7..2d8f9bf0 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -203,6 +203,9 @@ scheb_two_factor: cookie_name: wllbg_trusted_computer lifetime: 2592000 + backup_codes: + enabled: "%twofactor_auth%" + google: enabled: "%twofactor_auth%" template: WallabagUserBundle:Authentication:form.html.twig -- cgit v1.2.3 From 842af5c3571c5318ae4e1c81dc52457fbf6d3f21 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 5 Dec 2018 11:39:51 +0100 Subject: Add SQLite & PG migration Also remove the forced `server_version` from dbal config to avoid an hard overriding across all database. --- app/DoctrineMigrations/Version20181202073750.php | 46 +++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20181202073750.php b/app/DoctrineMigrations/Version20181202073750.php index b6ad8bd7..5978291e 100644 --- a/app/DoctrineMigrations/Version20181202073750.php +++ b/app/DoctrineMigrations/Version20181202073750.php @@ -6,21 +6,39 @@ use Doctrine\DBAL\Schema\Schema; use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** - * Add 2fa OTP (named google authenticator). + * Add 2fa OTP stuff. */ final class Version20181202073750 extends WallabagMigration { public function up(Schema $schema): void { - $tableName = $this->getTable('annotation'); - switch ($this->connection->getDatabasePlatform()->getName()) { case 'sqlite': + $this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297'); + $this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF'); + $this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8'); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('user', true) . ' AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication FROM ' . $this->getTable('user', true) . ''); + $this->addSql('DROP TABLE ' . $this->getTable('user', true) . ''); + $this->addSql('CREATE TABLE ' . $this->getTable('user', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT NULL COLLATE BINARY, username_canonical VARCHAR(180) NOT NULL COLLATE BINARY, email VARCHAR(180) NOT NULL COLLATE BINARY, email_canonical VARCHAR(180) NOT NULL COLLATE BINARY, enabled BOOLEAN NOT NULL, password VARCHAR(255) NOT NULL COLLATE BINARY, last_login DATETIME DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, emailTwoFactor BOOLEAN NOT NULL, salt VARCHAR(255) DEFAULT NULL, confirmation_token VARCHAR(180) DEFAULT NULL, roles CLOB NOT NULL --(DC2Type:array) + , googleAuthenticatorSecret VARCHAR(255) DEFAULT NULL, backupCodes CLOB DEFAULT NULL --(DC2Type:json_array) + )'); + $this->addSql('INSERT INTO ' . $this->getTable('user', true) . ' (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication FROM __temp__' . $this->getTable('user', true) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . ''); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON ' . $this->getTable('user', true) . ' (confirmation_token)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON ' . $this->getTable('user', true) . ' (email_canonical)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON ' . $this->getTable('user', true) . ' (username_canonical)'); break; case 'mysql': - $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL, CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL, DROP trusted, ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\''); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\''); break; case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN twofactorauthentication TO emailTwoFactor'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes TEXT DEFAULT NULL'); break; } } @@ -29,11 +47,29 @@ final class Version20181202073750 extends WallabagMigration { switch ($this->connection->getDatabasePlatform()->getName()) { case 'sqlite': + $this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8'); + $this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF'); + $this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297'); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('user', true) . ' AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor FROM "' . $this->getTable('user', true) . '"'); + $this->addSql('DROP TABLE "' . $this->getTable('user', true) . '"'); + $this->addSql('CREATE TABLE "' . $this->getTable('user', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL COLLATE BINARY, confirmation_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, roles CLOB NOT NULL COLLATE BINARY, trusted CLOB DEFAULT NULL COLLATE BINARY)'); + $this->addSql('INSERT INTO "' . $this->getTable('user', true) . '" (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor FROM __temp__' . $this->getTable('user', true) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . ''); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "' . $this->getTable('user', true) . '" (username_canonical)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "' . $this->getTable('user', true) . '" (email_canonical)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "' . $this->getTable('user', true) . '" (confirmation_token)'); break; case 'mysql': - $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret, CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL, ADD trusted TEXT DEFAULT NULL, DROP backupCodes'); + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret'); + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL'); + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` ADD trusted TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP backupCodes'); break; case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP googleAuthenticatorSecret'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN emailTwoFactor TO twofactorauthentication'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD trusted TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP backupCodes'); break; } } -- cgit v1.2.3 From c2efb5a3069b59341667626beb0fd6223a98189d Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 29 Jan 2019 14:24:38 +0100 Subject: Add missing entries in craue_config_setting. Should fix https://github.com/wallabag/wallabag/issues/3662 --- app/DoctrineMigrations/Version20190129120000.php | 74 ++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190129120000.php (limited to 'app') 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 @@ + "carrot", "value" => "1", "section" => "entry"), + array("name" => "share_diaspora", "value" => "1", "section" => "entry"), + array("name" => "diaspora_url", "value" => "http://diasporapod.com", "section" => "entry"), + array("name" => "share_shaarli", "value" => "1", "section" => "entry"), + array("name" => "shaarli_url", "value" => "http://myshaarli.com", "section" => "entry"), + array("name" => "share_mail", "value" => "1", "section" => "entry"), + array("name" => "share_twitter", "value" => "1", "section" => "entry"), + array("name" => "show_printlink", "value" => "1", "section" => "entry"), + array("name" => "export_epub", "value" => "1", "section" => "export"), + array("name" => "export_mobi", "value" => "1", "section" => "export"), + array("name" => "export_pdf", "value" => "1", "section" => "export"), + array("name" => "export_csv", "value" => "1", "section" => "export"), + array("name" => "export_json", "value" => "1", "section" => "export"), + array("name" => "export_txt", "value" => "1", "section" => "export"), + array("name" => "export_xml", "value" => "1", "section" => "export"), + array("name" => "piwik_enabled", "value" => "0", "section" => "analytics"), + array("name" => "piwik_host", "value" => "v2.wallabag.org", "section" => "analytics"), + array("name" => "piwik_site_id", "value" => "1", "section" => "analytics"), + array("name" => "demo_mode_enabled", "value" => "0", "section" => "misc"), + array("name" => "demo_mode_username", "value" => "wallabag", "section" => "misc"), + array("name" => "wallabag_support_url", "value" => "https://www.wallabag.org/pages/support.html", "section" => "misc"), + ); + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $piwikEnabled = $this->container + ->get('doctrine.orm.default_entity_manager') + ->getConnection() + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'piwik_enabled'"); + + $this->skipIf(false !== $piwikEnabled, 'It seems that you already played this migration, or user the wallabag:install command.'); + + foreach ($this->settings as $setting) { + $this->addSql(" + INSERT INTO " . $this->getTable('craue_config_setting') . " + (name, value, section) + VALUES ( + '" . $setting['name'] . "', + '" . $setting['value'] . "', + '" . $setting['section'] . "' + ); + "); + } + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + foreach ($this->settings as $setting) { + $this->addSql(" + DELETE FROM " . $this->getTable('craue_config_setting') . " + WHERE name = '" . $setting['name'] . "'; + "); + } + } +} -- cgit v1.2.3 From fcd54e2447332a681f5b1fde7e737ea5a8975823 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 27 Feb 2019 13:39:17 +0100 Subject: Test each internal settings before creating them --- app/DoctrineMigrations/Version20190129120000.php | 160 +++++++++++++++++------ 1 file changed, 119 insertions(+), 41 deletions(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190129120000.php b/app/DoctrineMigrations/Version20190129120000.php index 61e0ef4c..5f25d67d 100644 --- a/app/DoctrineMigrations/Version20190129120000.php +++ b/app/DoctrineMigrations/Version20190129120000.php @@ -8,54 +8,132 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** * Add missing entries in craue_config_setting. */ -class Version20190129120000 extends WallabagMigration +final class Version20190129120000 extends WallabagMigration { - var $settings = array( - array("name" => "carrot", "value" => "1", "section" => "entry"), - array("name" => "share_diaspora", "value" => "1", "section" => "entry"), - array("name" => "diaspora_url", "value" => "http://diasporapod.com", "section" => "entry"), - array("name" => "share_shaarli", "value" => "1", "section" => "entry"), - array("name" => "shaarli_url", "value" => "http://myshaarli.com", "section" => "entry"), - array("name" => "share_mail", "value" => "1", "section" => "entry"), - array("name" => "share_twitter", "value" => "1", "section" => "entry"), - array("name" => "show_printlink", "value" => "1", "section" => "entry"), - array("name" => "export_epub", "value" => "1", "section" => "export"), - array("name" => "export_mobi", "value" => "1", "section" => "export"), - array("name" => "export_pdf", "value" => "1", "section" => "export"), - array("name" => "export_csv", "value" => "1", "section" => "export"), - array("name" => "export_json", "value" => "1", "section" => "export"), - array("name" => "export_txt", "value" => "1", "section" => "export"), - array("name" => "export_xml", "value" => "1", "section" => "export"), - array("name" => "piwik_enabled", "value" => "0", "section" => "analytics"), - array("name" => "piwik_host", "value" => "v2.wallabag.org", "section" => "analytics"), - array("name" => "piwik_site_id", "value" => "1", "section" => "analytics"), - array("name" => "demo_mode_enabled", "value" => "0", "section" => "misc"), - array("name" => "demo_mode_username", "value" => "wallabag", "section" => "misc"), - array("name" => "wallabag_support_url", "value" => "https://www.wallabag.org/pages/support.html", "section" => "misc"), - ); + 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', + ], + ]; /** * @param Schema $schema */ public function up(Schema $schema) { - $piwikEnabled = $this->container - ->get('doctrine.orm.default_entity_manager') - ->getConnection() - ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'piwik_enabled'"); + foreach ($this->settings as $setting) { + $settingEnabled = $this->container + ->get('doctrine.orm.default_entity_manager') + ->getConnection() + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'"); - $this->skipIf(false !== $piwikEnabled, 'It seems that you already played this migration, or user the wallabag:install command.'); + if (false !== $settingEnabled) { + continue; + } - foreach ($this->settings as $setting) { - $this->addSql(" - INSERT INTO " . $this->getTable('craue_config_setting') . " - (name, value, section) - VALUES ( - '" . $setting['name'] . "', - '" . $setting['value'] . "', - '" . $setting['section'] . "' - ); - "); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('" . $setting['name'] . "', '" . $setting['value'] . "', '" . $setting['section'] . "');"); } } @@ -65,8 +143,8 @@ class Version20190129120000 extends WallabagMigration public function down(Schema $schema) { foreach ($this->settings as $setting) { - $this->addSql(" - DELETE FROM " . $this->getTable('craue_config_setting') . " + $this->addSql(' + DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'; "); } -- cgit v1.2.3 From 85403dae0463660f86de68970dcd1a5cbe784a31 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 1 Mar 2019 20:26:51 +0100 Subject: Disable down for that migration --- app/DoctrineMigrations/Version20190129120000.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190129120000.php b/app/DoctrineMigrations/Version20190129120000.php index 5f25d67d..3632e762 100644 --- a/app/DoctrineMigrations/Version20190129120000.php +++ b/app/DoctrineMigrations/Version20190129120000.php @@ -142,11 +142,6 @@ final class Version20190129120000 extends WallabagMigration */ public function down(Schema $schema) { - foreach ($this->settings as $setting) { - $this->addSql(' - DELETE FROM ' . $this->getTable('craue_config_setting') . " - WHERE name = '" . $setting['name'] . "'; - "); - } + $this->skipIf(true, 'These settings are required and should not be removed.'); } } -- cgit v1.2.3 From 9c2b2aae70b06411336e6eb6ac43b3ebd30dc38c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 11:50:33 +0200 Subject: Keep url in exists endpoint - Add migration - Use md5 instead of sha512 (we don't need security here, just a hash) - Update tests --- app/DoctrineMigrations/Version20190401105353.php | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190401105353.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php new file mode 100644 index 00000000..4afc8b15 --- /dev/null +++ b/app/DoctrineMigrations/Version20190401105353.php @@ -0,0 +1,44 @@ +getTable($this->getTable('entry')); + + $this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); + + $entryTable->addColumn('hashed_url', 'text', [ + 'length' => 32, + 'notnull' => false, + ]); + + // sqlite doesn't have the MD5 function by default + if ('sqlite' !== $this->connection->getDatabasePlatform()->getName()) { + $this->addSql('UPDATE ' . $this->getTable('entry') . ' SET hashed_url = MD5(url)'); + } + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); + + $entryTable->dropColumn('hashed_url'); + } +} -- cgit v1.2.3 From 8a6456629814039cfc623cdb279bcba06dacff50 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 13:51:57 +0200 Subject: Use a better index for hashed_url It'll most often be used in addition to the `user_id`. Also, automatically generate the hash when saving the url. Switch from `md5` to `sha1`. --- app/DoctrineMigrations/Version20190401105353.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php index 4afc8b15..c1c22053 100644 --- a/app/DoctrineMigrations/Version20190401105353.php +++ b/app/DoctrineMigrations/Version20190401105353.php @@ -20,7 +20,7 @@ class Version20190401105353 extends WallabagMigration $this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); $entryTable->addColumn('hashed_url', 'text', [ - 'length' => 32, + 'length' => 40, 'notnull' => false, ]); @@ -28,6 +28,8 @@ class Version20190401105353 extends WallabagMigration if ('sqlite' !== $this->connection->getDatabasePlatform()->getName()) { $this->addSql('UPDATE ' . $this->getTable('entry') . ' SET hashed_url = MD5(url)'); } + + $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id'); } /** @@ -39,6 +41,7 @@ class Version20190401105353 extends WallabagMigration $this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.'); + $entryTable->dropIndex('hashed_url_user_id'); $entryTable->dropColumn('hashed_url'); } } -- cgit v1.2.3 From c579ce2306297674c56376a2ab5c8ba66a272253 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 14:34:20 +0200 Subject: Some cleanup Also, do not run the hashed_url migration into a Doctrine migration --- app/DoctrineMigrations/Version20190401105353.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php index c1c22053..94ebb1ab 100644 --- a/app/DoctrineMigrations/Version20190401105353.php +++ b/app/DoctrineMigrations/Version20190401105353.php @@ -24,11 +24,6 @@ class Version20190401105353 extends WallabagMigration 'notnull' => false, ]); - // sqlite doesn't have the MD5 function by default - if ('sqlite' !== $this->connection->getDatabasePlatform()->getName()) { - $this->addSql('UPDATE ' . $this->getTable('entry') . ' SET hashed_url = MD5(url)'); - } - $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id'); } -- cgit v1.2.3 From 5cc0646e66f52448f83a7a458e0b60b4580e83e5 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 Apr 2019 15:45:17 +0200 Subject: Fix index on MySQL --- app/DoctrineMigrations/Version20190401105353.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php index 94ebb1ab..d27962db 100644 --- a/app/DoctrineMigrations/Version20190401105353.php +++ b/app/DoctrineMigrations/Version20190401105353.php @@ -24,7 +24,7 @@ class Version20190401105353 extends WallabagMigration 'notnull' => false, ]); - $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id'); + $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]); } /** -- cgit v1.2.3 From 531c8d0a5c55fa93438e227a7d349235fbd31d28 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 13 Jun 2017 18:48:10 +0200 Subject: Changed RSS to Atom feed and improve paging --- app/Resources/static/themes/baggy/css/article.scss | 6 +++--- app/Resources/static/themes/baggy/css/pictos.scss | 2 +- app/config/security.yml | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/Resources/static/themes/baggy/css/article.scss b/app/Resources/static/themes/baggy/css/article.scss index 9094ad55..d203ce31 100644 --- a/app/Resources/static/themes/baggy/css/article.scss +++ b/app/Resources/static/themes/baggy/css/article.scss @@ -85,7 +85,7 @@ blockquote { color: #999; } -.icon-rss { +.icon-feed { background-color: #000; color: #fff; padding: 0.2em 0.5em; @@ -101,8 +101,8 @@ blockquote { margin-bottom: 0.5em; } - .icon-rss:hover, - .icon-rss:focus { + .icon-feed:hover, + .icon-feed:focus { background-color: #fff; color: #000; text-decoration: none; diff --git a/app/Resources/static/themes/baggy/css/pictos.scss b/app/Resources/static/themes/baggy/css/pictos.scss index 2ff01937..b6ebf311 100644 --- a/app/Resources/static/themes/baggy/css/pictos.scss +++ b/app/Resources/static/themes/baggy/css/pictos.scss @@ -136,7 +136,7 @@ content: "\ea3a"; } -.icon-rss::before { +.icon-feed::before { content: "\e808"; } diff --git a/app/config/security.yml b/app/config/security.yml index 6a21b4e5..760b2550 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -72,6 +72,8 @@ security: - { path: /(unread|starred|archive|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/locale, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/feed, roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } # For backwards compatibility - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/settings, roles: ROLE_SUPER_ADMIN } - { path: ^/annotations, roles: ROLE_USER } -- cgit v1.2.3 From f277bc042c8e805aab14b31b5b51e2878d80c6f4 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 25 Apr 2019 14:12:56 +0200 Subject: Fix tests & cs & migration --- app/DoctrineMigrations/Version20190425115043.php | 58 ++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190425115043.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190425115043.php b/app/DoctrineMigrations/Version20190425115043.php new file mode 100644 index 00000000..4c5c49cc --- /dev/null +++ b/app/DoctrineMigrations/Version20190425115043.php @@ -0,0 +1,58 @@ +connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395'); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM ' . $this->getTable('config', true)); + $this->addSql('DROP TABLE ' . $this->getTable('config', true)); + $this->addSql('CREATE TABLE ' . $this->getTable('config', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL COLLATE BINARY, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL COLLATE BINARY, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL COLLATE BINARY, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, feed_token VARCHAR(255) DEFAULT NULL, feed_limit INTEGER DEFAULT NULL, CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO ' . $this->getTable('config', true) . ' (id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true)); + $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON ' . $this->getTable('config', true) . ' (user_id)'); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_token feed_token VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_limit feed_limit INT DEFAULT NULL'); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_token TO feed_token'); + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_limit TO feed_limit'); + break; + } + } + + public function down(Schema $schema): void + { + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395'); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM "' . $this->getTable('config', true) . '"'); + $this->addSql('DROP TABLE "' . $this->getTable('config', true) . '"'); + $this->addSql('CREATE TABLE "' . $this->getTable('config', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, rss_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, rss_limit INTEGER DEFAULT NULL)'); + $this->addSql('INSERT INTO "' . $this->getTable('config', true) . '" (id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true)); + $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "' . $this->getTable('config', true) . '" (user_id)'); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_token rss_token'); + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_limit rss_limit'); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_token TO rss_token'); + $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_limit TO rss_limit'); + break; + } + } +} -- cgit v1.2.3 From 68a90821a305867e9b655da2dbfe558d37253990 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 26 Apr 2019 13:40:58 +0200 Subject: Handle redirection from previous feeds --- app/config/routing.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'app') diff --git a/app/config/routing.yml b/app/config/routing.yml index a7c0f7e9..d4defca0 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -59,3 +59,39 @@ fos_js_routing: 2fa_login_check: path: /2fa_check + +# redirect RSS feed to Atom +rss_to_atom_unread: + path: /{username}/{token}/unread.xml + defaults: + _controller: FrameworkBundle:Redirect:redirect + route: unread_feed + permanent: true + +rss_to_atom_archive: + path: /{username}/{token}/archive.xml + defaults: + _controller: FrameworkBundle:Redirect:redirect + route: archive_feed + permanent: true + +rss_to_atom_starred: + path: /{username}/{token}/starred.xml + defaults: + _controller: FrameworkBundle:Redirect:redirect + route: starred_feed + permanent: true + +rss_to_atom_all: + path: /{username}/{token}/all.xml + defaults: + _controller: FrameworkBundle:Redirect:redirect + route: all_feed + permanent: true + +rss_to_atom_tags: + path: /{username}/{token}/tags/{slug}.xml + defaults: + _controller: FrameworkBundle:Redirect:redirect + route: tag_feed + permanent: true -- cgit v1.2.3 From 637f0df9760b50b56c8ffb200719907032fdd885 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 10 May 2019 16:49:19 +0200 Subject: Cascade delete on oauth2 table when deleting a user --- app/DoctrineMigrations/Version20190510141130.php | 95 ++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 app/DoctrineMigrations/Version20190510141130.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php new file mode 100644 index 00000000..adfe73a0 --- /dev/null +++ b/app/DoctrineMigrations/Version20190510141130.php @@ -0,0 +1,95 @@ +connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $this->addSql('DROP INDEX IDX_368A4209A76ED395'); + $this->addSql('DROP INDEX IDX_368A420919EB6921'); + $this->addSql('DROP INDEX UNIQ_368A42095F37A13B'); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true) . ''); + $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_access_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NOT NULL, CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO ' . $this->getTable('oauth2_access_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_access_tokens', true) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true) . ''); + $this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)'); + $this->addSql('CREATE INDEX IDX_368A420919EB6921 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (client_id)'); + + $this->addSql('DROP INDEX IDX_635D765EA76ED395'); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_clients', true) . ' AS SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM ' . $this->getTable('oauth2_clients', true) . ''); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true) . ''); + $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_clients', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, random_id VARCHAR(255) NOT NULL COLLATE BINARY, secret VARCHAR(255) NOT NULL COLLATE BINARY, name CLOB NOT NULL COLLATE BINARY, redirect_uris CLOB NOT NULL --(DC2Type:array), allowed_grant_types CLOB NOT NULL --(DC2Type:array), CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO ' . $this->getTable('oauth2_clients', true) . ' (id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name) SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM __temp__' . $this->getTable('oauth2_clients', true) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true) . ''); + $this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $this->getTable('oauth2_clients', true) . ' (user_id)'); + + $this->addSql('DROP INDEX IDX_20C9FB24A76ED395'); + $this->addSql('DROP INDEX IDX_20C9FB2419EB6921'); + $this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B'); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NOT NULL, CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)'); + $this->addSql('CREATE INDEX IDX_20C9FB2419EB6921 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (client_id)'); + + $this->addSql('DROP INDEX IDX_EE52E3FAA76ED395'); + $this->addSql('DROP INDEX IDX_EE52E3FA19EB6921'); + $this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B'); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ' AS SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM ' . $this->getTable('oauth2_auth_codes', true) . ''); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true) . ''); + $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_auth_codes', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, redirect_uri CLOB NOT NULL COLLATE BINARY, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NOT NULL, CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO ' . $this->getTable('oauth2_auth_codes', true) . ' (id, client_id, user_id, token, redirect_uri, expires_at, scope) SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM __temp__' . $this->getTable('oauth2_auth_codes', true) . ''); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ''); + $this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)'); + $this->addSql('CREATE INDEX IDX_EE52E3FA19EB6921 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (client_id)'); + break; + case 'mysql': + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP FOREIGN KEY FK_368A4209A76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP FOREIGN KEY IDX_user_oauth_client'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id)'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP FOREIGN KEY FK_20C9FB24A76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP FOREIGN KEY FK_EE52E3FAA76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE'); + break; + case 'postgresql': + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP CONSTRAINT FK_368A4209A76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP CONSTRAINT idx_user_oauth_client'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP CONSTRAINT FK_20C9FB24A76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP CONSTRAINT FK_EE52E3FAA76ED395'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + break; + } + } + + public function down(Schema $schema): void + { + throw new SkipMigrationException('Too complex ...'); + } +} -- cgit v1.2.3 From d2ef2d6df8db302dd53af5cf960a101b4301cdc8 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 10 May 2019 20:36:25 +0200 Subject: Fix SQLite migration --- app/DoctrineMigrations/Version20190510141130.php | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php index adfe73a0..5fc1dba4 100644 --- a/app/DoctrineMigrations/Version20190510141130.php +++ b/app/DoctrineMigrations/Version20190510141130.php @@ -22,40 +22,41 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX IDX_368A4209A76ED395'); $this->addSql('DROP INDEX IDX_368A420919EB6921'); $this->addSql('DROP INDEX UNIQ_368A42095F37A13B'); - $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true) . ''); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_access_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_access_tokens', true)); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true)); $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_access_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NOT NULL, CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); - $this->addSql('INSERT INTO ' . $this->getTable('oauth2_access_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_access_tokens', true) . ''); - $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true) . ''); + $this->addSql('INSERT INTO ' . $this->getTable('oauth2_access_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_access_tokens', true)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true)); $this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)'); $this->addSql('CREATE INDEX IDX_368A420919EB6921 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (client_id)'); $this->addSql('DROP INDEX IDX_635D765EA76ED395'); - $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_clients', true) . ' AS SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM ' . $this->getTable('oauth2_clients', true) . ''); - $this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true) . ''); - $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_clients', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, random_id VARCHAR(255) NOT NULL COLLATE BINARY, secret VARCHAR(255) NOT NULL COLLATE BINARY, name CLOB NOT NULL COLLATE BINARY, redirect_uris CLOB NOT NULL --(DC2Type:array), allowed_grant_types CLOB NOT NULL --(DC2Type:array), CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); - $this->addSql('INSERT INTO ' . $this->getTable('oauth2_clients', true) . ' (id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name) SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM __temp__' . $this->getTable('oauth2_clients', true) . ''); - $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true) . ''); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_clients', true) . ' AS SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM ' . $this->getTable('oauth2_clients', true)); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true)); + $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_clients', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, random_id VARCHAR(255) NOT NULL COLLATE BINARY, secret VARCHAR(255) NOT NULL COLLATE BINARY, name CLOB NOT NULL COLLATE BINARY, redirect_uris CLOB NOT NULL, allowed_grant_types CLOB NOT NULL, CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO ' . $this->getTable('oauth2_clients', true) . ' (id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name) SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM __temp__' . $this->getTable('oauth2_clients', true)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true)); $this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $this->getTable('oauth2_clients', true) . ' (user_id)'); $this->addSql('DROP INDEX IDX_20C9FB24A76ED395'); $this->addSql('DROP INDEX IDX_20C9FB2419EB6921'); $this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B'); - $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_refresh_tokens', true) . ''); - $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_refresh_tokens', true)); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true)); $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NOT NULL, CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); - $this->addSql('INSERT INTO ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ''); - $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ''); + $this->addSql('INSERT INTO ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_refresh_tokens', true)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true)); $this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)'); $this->addSql('CREATE INDEX IDX_20C9FB2419EB6921 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (client_id)'); $this->addSql('DROP INDEX IDX_EE52E3FAA76ED395'); $this->addSql('DROP INDEX IDX_EE52E3FA19EB6921'); $this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B'); - $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ' AS SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM ' . $this->getTable('oauth2_auth_codes', true) . ''); - $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true) . ''); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ' AS SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM ' . $this->getTable('oauth2_auth_codes', true)); + $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true)); $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_auth_codes', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, redirect_uri CLOB NOT NULL COLLATE BINARY, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NOT NULL, CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); - $this->addSql('INSERT INTO ' . $this->getTable('oauth2_auth_codes', true) . ' (id, client_id, user_id, token, redirect_uri, expires_at, scope) SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM __temp__' . $this->getTable('oauth2_auth_codes', true) . ''); - $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ''); + $this->addSql('INSERT INTO ' . $this->getTable('oauth2_auth_codes', true) . ' (id, client_id, user_id, token, redirect_uri, expires_at, scope) SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM __temp__' . $this->getTable('oauth2_auth_codes', true)); + $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true)); $this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)'); $this->addSql('CREATE INDEX IDX_EE52E3FA19EB6921 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (client_id)'); break; -- cgit v1.2.3 From 754bf12e6724b1cd6c6d2da85a377cd96865131d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 10 May 2019 21:15:46 +0200 Subject: Fix SQLite constraint --- app/DoctrineMigrations/Version20190510141130.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php index 5fc1dba4..524aa452 100644 --- a/app/DoctrineMigrations/Version20190510141130.php +++ b/app/DoctrineMigrations/Version20190510141130.php @@ -24,7 +24,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_368A42095F37A13B'); $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_access_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_access_tokens', true)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true)); - $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_access_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NOT NULL, CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_access_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); $this->addSql('INSERT INTO ' . $this->getTable('oauth2_access_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_access_tokens', true)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true)); $this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)'); @@ -43,7 +43,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B'); $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_refresh_tokens', true)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true)); - $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NOT NULL, CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); $this->addSql('INSERT INTO ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_refresh_tokens', true)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true)); $this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)'); @@ -54,7 +54,7 @@ final class Version20190510141130 extends WallabagMigration $this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B'); $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ' AS SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM ' . $this->getTable('oauth2_auth_codes', true)); $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true)); - $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_auth_codes', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, redirect_uri CLOB NOT NULL COLLATE BINARY, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NOT NULL, CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_auth_codes', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, redirect_uri CLOB NOT NULL COLLATE BINARY, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)'); $this->addSql('INSERT INTO ' . $this->getTable('oauth2_auth_codes', true) . ' (id, client_id, user_id, token, redirect_uri, expires_at, scope) SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM __temp__' . $this->getTable('oauth2_auth_codes', true)); $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true)); $this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)'); -- cgit v1.2.3 From bf9ace0643f654e7ccd9c020b8b501ad56cd19de Mon Sep 17 00:00:00 2001 From: adev Date: Tue, 24 Oct 2017 22:55:40 +0200 Subject: Use httplug --- app/AppKernel.php | 1 + app/config/config.yml | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'app') diff --git a/app/AppKernel.php b/app/AppKernel.php index 7d19e9ab..4a54da29 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -34,6 +34,7 @@ class AppKernel extends Kernel new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new BD\GuzzleSiteAuthenticatorBundle\BDGuzzleSiteAuthenticatorBundle(), new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(), + new Http\HttplugBundle\HttplugBundle(), // wallabag bundles new Wallabag\CoreBundle\WallabagCoreBundle(), diff --git a/app/config/config.yml b/app/config/config.yml index 078f277a..309945c5 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -370,3 +370,22 @@ jms_serializer: sensio_framework_extra: router: annotations: false + +httplug: + clients: + wallabag_core: + factory: 'wallabag_core.http_client_factory' + plugins: ['httplug.plugin.logger'] + wallabag_core.entry.download_images: + factory: 'httplug.factory.auto' + plugins: ['httplug.plugin.logger'] + wallabag_import.pocket.client: + factory: 'httplug.factory.auto' + plugins: + - 'httplug.plugin.logger' + - header_defaults: + headers: + 'content-type': 'application/json' + 'X-Accept': 'application/json' + discovery: + client: false -- cgit v1.2.3 From 1048c9c4a811821b00cc04bfec905bebcc22bac4 Mon Sep 17 00:00:00 2001 From: adev Date: Sun, 12 Nov 2017 12:15:02 +0100 Subject: Configure timeout --- app/config/config.yml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app') diff --git a/app/config/config.yml b/app/config/config.yml index 309945c5..bbcc682f 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -375,6 +375,9 @@ httplug: clients: wallabag_core: factory: 'wallabag_core.http_client_factory' + config: + defaults: + timeout: 10 plugins: ['httplug.plugin.logger'] wallabag_core.entry.download_images: factory: 'httplug.factory.auto' -- cgit v1.2.3