aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/config/config.yml1
-rw-r--r--app/config/config_test.yml1
-rw-r--r--app/config/parameters.yml.dist2
-rw-r--r--app/config/parameters_test.yml1
-rw-r--r--app/config/tests/parameters_test.mysql.yml1
-rw-r--r--app/config/tests/parameters_test.pgsql.yml1
-rw-r--r--app/config/tests/parameters_test.sqlite.yml1
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php25
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php38
9 files changed, 0 insertions, 71 deletions
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:
46doctrine: 46doctrine:
47 dbal: 47 dbal:
48 driver: "%database_driver%" 48 driver: "%database_driver%"
49 driver_class: "%database_driver_class%"
50 host: "%database_host%" 49 host: "%database_host%"
51 port: "%database_port%" 50 port: "%database_port%"
52 dbname: "%database_name%" 51 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:
24doctrine: 24doctrine:
25 dbal: 25 dbal:
26 driver: "%test_database_driver%" 26 driver: "%test_database_driver%"
27 driver_class: "%test_database_driver_class%"
28 host: "%test_database_host%" 27 host: "%test_database_host%"
29 port: "%test_database_port%" 28 port: "%test_database_port%"
30 dbname: "%test_database_name%" 29 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:
11 # database_password: %env.database_password% 11 # database_password: %env.database_password%
12 12
13 database_driver: pdo_mysql 13 database_driver: pdo_mysql
14 database_driver_class: ~
15 # database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
16 database_host: 127.0.0.1 14 database_host: 127.0.0.1
17 database_port: ~ 15 database_port: ~
18 database_name: wallabag 16 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:
8 test_database_path: "%env(TEST_DATABASE_PATH)%" 8 test_database_path: "%env(TEST_DATABASE_PATH)%"
9 env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite" 9 env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite"
10 test_database_charset: utf8 10 test_database_charset: utf8
11 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 @@
1parameters: 1parameters:
2 test_database_driver: pdo_mysql 2 test_database_driver: pdo_mysql
3 test_database_driver_class: ~
4 test_database_host: localhost 3 test_database_host: localhost
5 test_database_port: 3306 4 test_database_port: 3306
6 test_database_name: wallabag_test 5 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 @@
1parameters: 1parameters:
2 test_database_driver: pdo_pgsql 2 test_database_driver: pdo_pgsql
3 test_database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
4 test_database_host: localhost 3 test_database_host: localhost
5 test_database_port: 4 test_database_port:
6 test_database_name: wallabag_test 5 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 @@
1parameters: 1parameters:
2 test_database_driver: pdo_sqlite 2 test_database_driver: pdo_sqlite
3 test_database_driver_class: ~
4 test_database_host: localhost 3 test_database_host: localhost
5 test_database_port: 4 test_database_port:
6 test_database_name: ~ 5 test_database_name: ~
diff --git a/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php b/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php
deleted file mode 100644
index eb5b203f..00000000
--- a/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php
+++ /dev/null
@@ -1,25 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Doctrine\DBAL\Driver;
4
5use Doctrine\DBAL\Connection;
6use Doctrine\DBAL\Driver\PDOPgSql\Driver;
7use Wallabag\CoreBundle\Doctrine\DBAL\Schema\CustomPostgreSqlSchemaManager;
8
9/**
10 * This custom driver allow to use a different schema manager
11 * So we can fix the PostgreSQL 10 problem.
12 *
13 * @see https://github.com/wallabag/wallabag/issues/3479
14 * @see https://github.com/doctrine/dbal/issues/2868
15 */
16class CustomPostgreSQLDriver extends Driver
17{
18 /**
19 * {@inheritdoc}
20 */
21 public function getSchemaManager(Connection $conn)
22 {
23 return new CustomPostgreSqlSchemaManager($conn);
24 }
25}
diff --git a/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php b/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php
deleted file mode 100644
index 439ae17d..00000000
--- a/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php
+++ /dev/null
@@ -1,38 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Doctrine\DBAL\Schema;
4
5use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
6use Doctrine\DBAL\Schema\Sequence;
7
8/**
9 * This custom schema manager fix the PostgreSQL 10 problem.
10 *
11 * @see https://github.com/wallabag/wallabag/issues/3479
12 * @see https://github.com/doctrine/dbal/issues/2868
13 */
14class CustomPostgreSqlSchemaManager extends PostgreSqlSchemaManager
15{
16 /**
17 * {@inheritdoc}
18 */
19 protected function _getPortableSequenceDefinition($sequence)
20 {
21 $sequenceName = $sequence['relname'];
22 if ('public' !== $sequence['schemaname']) {
23 $sequenceName = $sequence['schemaname'] . '.' . $sequence['relname'];
24 }
25
26 $query = 'SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName);
27
28 // the `method_exists` is only to avoid test to fail:
29 // DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticConnection doesn't support the `getServerVersion`
30 if (method_exists($this->_conn->getWrappedConnection(), 'getServerVersion') && (float) ($this->_conn->getWrappedConnection()->getServerVersion()) >= 10) {
31 $query = "SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = 'public' AND sequencename = " . $this->_conn->quote($sequenceName);
32 }
33
34 $data = $this->_conn->fetchAll($query);
35
36 return new Sequence($sequenceName, $data[0]['increment_by'], $data[0]['min_value']);
37 }
38}