aboutsummaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/AppKernel.php22
-rwxr-xr-xapp/DoctrineMigrations/Version20180405182455.php21
-rw-r--r--app/DoctrineMigrations/Version20181128203230.php45
-rw-r--r--app/autoload.php13
-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/services_test.yml12
-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
12 files changed, 72 insertions, 49 deletions
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 @@
1<?php 1<?php
2 2
3use Symfony\Component\Config\Loader\LoaderInterface; 3use Symfony\Component\Config\Loader\LoaderInterface;
4use Symfony\Component\DependencyInjection\ContainerBuilder;
4use Symfony\Component\HttpKernel\Kernel; 5use Symfony\Component\HttpKernel\Kernel;
5 6
6class AppKernel extends Kernel 7class AppKernel extends Kernel
@@ -46,18 +47,26 @@ class AppKernel extends Kernel
46 $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 47 $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
47 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 48 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
48 $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 49 $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
49 $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
50 $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); 50 $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
51 $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
52 51
53 if ('test' === $this->getEnvironment()) { 52 if ('test' === $this->getEnvironment()) {
54 $bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle(); 53 $bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle();
55 } 54 }
55
56 if ('dev' === $this->getEnvironment()) {
57 $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
58 $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
59 }
56 } 60 }
57 61
58 return $bundles; 62 return $bundles;
59 } 63 }
60 64
65 public function getRootDir()
66 {
67 return __DIR__;
68 }
69
61 public function getCacheDir() 70 public function getCacheDir()
62 { 71 {
63 return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); 72 return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
@@ -70,7 +79,8 @@ class AppKernel extends Kernel
70 79
71 public function registerContainerConfiguration(LoaderInterface $loader) 80 public function registerContainerConfiguration(LoaderInterface $loader)
72 { 81 {
73 $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml'); 82 $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
83
74 $loader->load(function ($container) { 84 $loader->load(function ($container) {
75 if ($container->getParameter('use_webpack_dev_server')) { 85 if ($container->getParameter('use_webpack_dev_server')) {
76 $container->loadFromExtension('framework', [ 86 $container->loadFromExtension('framework', [
@@ -86,5 +96,11 @@ class AppKernel extends Kernel
86 ]); 96 ]);
87 } 97 }
88 }); 98 });
99
100 $loader->load(function (ContainerBuilder $container) {
101 // $container->setParameter('container.autowiring.strict_mode', true);
102 // $container->setParameter('container.dumper.inline_class_loader', true);
103 $container->addObjectResource($this);
104 });
89 } 105 }
90} 106}
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,27 +2,15 @@
2 2
3namespace Application\Migrations; 3namespace Application\Migrations;
4 4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema; 5use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface; 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9 7
10/** 8/**
11 * Add archived_at column and set its value to updated_at for is_archived entries. 9 * Add archived_at column and set its value to updated_at for is_archived entries.
12 */ 10 */
13class Version20180405182455 extends AbstractMigration implements ContainerAwareInterface 11class Version20180405182455 extends WallabagMigration
14{ 12{
15 /** 13 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 /**
26 * @param Schema $schema 14 * @param Schema $schema
27 */ 15 */
28 public function up(Schema $schema) 16 public function up(Schema $schema)
@@ -60,9 +48,4 @@ class Version20180405182455 extends AbstractMigration implements ContainerAwareI
60 48
61 $entryTable->dropColumn('archived_at'); 49 $entryTable->dropColumn('archived_at');
62 } 50 }
63
64 private function getTable($tableName)
65 {
66 return $this->container->getParameter('database_table_prefix') . $tableName;
67 }
68} 51}
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 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Fix varchar field from vendor to work with utf8mb4.
10 */
11class Version20181128203230 extends WallabagMigration
12{
13 /**
14 * @param Schema $schema
15 */
16 public function up(Schema $schema)
17 {
18 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
19
20 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
21 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)');
22 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL');
23 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)');
24 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
25 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)');
26 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)');
27 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)');
28 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)');
29 }
30
31 public function down(Schema $schema)
32 {
33 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
34
35 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
36 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)');
37 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL');
38 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)');
39 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
40 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)');
41 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)');
42 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)');
43 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)');
44 }
45}
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 @@
1<?php
2
3use Composer\Autoload\ClassLoader;
4use Doctrine\Common\Annotations\AnnotationRegistry;
5
6/**
7 * @var ClassLoader
8 */
9$loader = require __DIR__ . '/../vendor/autoload.php';
10
11AnnotationRegistry::registerLoader([$loader, 'loadClass']);
12
13return $loader;
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/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:
22 - "%kernel.cache_dir%/doctrine/metadata" 22 - "%kernel.cache_dir%/doctrine/metadata"
23 23
24 # fixtures 24 # fixtures
25 Wallabag\AnnotationBundle\DataFixtures\ORM\: 25 Wallabag\UserBundle\DataFixtures\:
26 resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/ORM/*' 26 resource: '../../src/Wallabag/UserBundle/DataFixtures/*'
27 tags: ['doctrine.fixture.orm'] 27 tags: ['doctrine.fixture.orm']
28 autowire: true 28 autowire: true
29 29
30 Wallabag\CoreBundle\DataFixtures\ORM\: 30 Wallabag\CoreBundle\DataFixtures\:
31 resource: '../../src/Wallabag/CoreBundle/DataFixtures/ORM/*' 31 resource: '../../src/Wallabag/CoreBundle/DataFixtures/*'
32 tags: ['doctrine.fixture.orm'] 32 tags: ['doctrine.fixture.orm']
33 autowire: true 33 autowire: true
34 34
35 Wallabag\UserBundle\DataFixtures\ORM\: 35 Wallabag\AnnotationBundle\DataFixtures\:
36 resource: '../../src/Wallabag/UserBundle/DataFixtures/ORM/*' 36 resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/*'
37 tags: ['doctrine.fixture.orm'] 37 tags: ['doctrine.fixture.orm']
38 autowire: true 38 autowire: true
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: ~