Replace kernel.root_dir by kernel.project_dir

kernel.root_dir and Kernel::getRootDir() are deprecated since Symfony 3.3.
See https://symfony.com/blog/new-in-symfony-3-3-a-simpler-way-to-get-the-project-root-directory and https://github.com/symfony/symfony/blob/3.3/UPGRADE-3.3.md#httpkernel for more information.
This commit is contained in:
Nicolas Hart 2017-10-13 23:52:15 +02:00
parent f44a927530
commit 9ca069a6fe
11 changed files with 15 additions and 20 deletions

View file

@ -57,11 +57,6 @@ class AppKernel extends Kernel
return $bundles; return $bundles;
} }
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir() public function getCacheDir()
{ {
return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
@ -74,7 +69,7 @@ class AppKernel extends Kernel
public function registerContainerConfiguration(LoaderInterface $loader) public function registerContainerConfiguration(LoaderInterface $loader)
{ {
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml');
$loader->load(function ($container) { $loader->load(function ($container) {
if ($container->getParameter('use_webpack_dev_server')) { if ($container->getParameter('use_webpack_dev_server')) {
$container->loadFromExtension('framework', [ $container->loadFromExtension('framework', [

View file

@ -16,7 +16,7 @@ framework:
fallback: "%locale%" fallback: "%locale%"
secret: "%secret%" secret: "%secret%"
router: router:
resource: "%kernel.root_dir%/config/routing.yml" resource: "%kernel.project_dir%/app/config/routing.yml"
strict_requirements: ~ strict_requirements: ~
form: ~ form: ~
csrf_protection: ~ csrf_protection: ~
@ -30,7 +30,7 @@ framework:
session: session:
# handler_id set to null will use default session handler from php.ini # handler_id set to null will use default session handler from php.ini
handler_id: session.handler.native_file handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%" save_path: "%kernel.project_dir%/var/sessions/%kernel.environment%"
fragments: ~ fragments: ~
http_method_override: true http_method_override: true
assets: ~ assets: ~
@ -72,7 +72,7 @@ stof_doctrine_extensions:
sluggable: true sluggable: true
doctrine_migrations: doctrine_migrations:
dir_name: "%kernel.root_dir%/DoctrineMigrations" dir_name: "%kernel.project_dir%/app/DoctrineMigrations"
namespace: Application\Migrations namespace: Application\Migrations
table_name: migration_versions table_name: migration_versions
name: Application Migrations name: Application Migrations

View file

@ -3,7 +3,7 @@ imports:
framework: framework:
router: router:
resource: "%kernel.root_dir%/config/routing_dev.yml" resource: "%kernel.project_dir%/app/config/routing_dev.yml"
strict_requirements: true strict_requirements: true
profiler: profiler:
only_exceptions: false only_exceptions: false

View file

@ -3,7 +3,7 @@ imports:
framework: framework:
assets: assets:
# json_manifest_path: '%kernel.root_dir%/../web/bundles/wallabagcore/manifest.json' # json_manifest_path: '%kernel.project_dir%/web/bundles/wallabagcore/manifest.json'
#doctrine: #doctrine:
# orm: # orm:

View file

@ -16,7 +16,7 @@ parameters:
database_name: wallabag database_name: wallabag
database_user: root database_user: root
database_password: ~ database_password: ~
# For SQLite, database_path should be "%kernel.root_dir%/../data/db/wallabag.sqlite" # For SQLite, database_path should be "%kernel.project_dir%/data/db/wallabag.sqlite"
database_path: null database_path: null
database_table_prefix: wallabag_ database_table_prefix: wallabag_
database_socket: null database_socket: null

View file

@ -6,5 +6,5 @@ parameters:
test_database_user: null test_database_user: null
test_database_password: null test_database_password: null
test_database_path: "%env(TEST_DATABASE_PATH)%" test_database_path: "%env(TEST_DATABASE_PATH)%"
env(TEST_DATABASE_PATH): "%kernel.root_dir%/../data/db/wallabag_test.sqlite" env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite"
test_database_charset: utf8 test_database_charset: utf8

View file

@ -8,5 +8,5 @@ parameters:
# Using an environnement variable in order to avoid the error "attempt to write a readonly database" # Using an environnement variable in order to avoid the error "attempt to write a readonly database"
# when the schema is dropped then recreate # when the schema is dropped then recreate
test_database_path: "%env(TEST_DATABASE_PATH)%" test_database_path: "%env(TEST_DATABASE_PATH)%"
env(TEST_DATABASE_PATH): "%kernel.root_dir%/../data/db/wallabag_test.sqlite" env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite"
test_database_charset: utf8 test_database_charset: utf8

View file

@ -27,7 +27,7 @@ wallabag_core:
fetching_error_message: | fetching_error_message: |
wallabag can't retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>. wallabag can't retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.
api_limit_mass_actions: 10 api_limit_mass_actions: 10
encryption_key_path: "%kernel.root_dir%/../data/site-credentials-secret-key.txt" encryption_key_path: "%kernel.project_dir%/data/site-credentials-secret-key.txt"
default_internal_settings: default_internal_settings:
- -
name: share_public name: share_public
@ -159,4 +159,4 @@ wallabag_user:
wallabag_import: wallabag_import:
allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain', 'text/csv'] allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain', 'text/csv']
resource_dir: "%kernel.root_dir%/../web/uploads/import" resource_dir: "%kernel.project_dir%/web/uploads/import"

View file

@ -52,7 +52,7 @@ class ExportCommand extends ContainerAwareCommand
$filePath = $input->getArgument('filepath'); $filePath = $input->getArgument('filepath');
if (!$filePath) { if (!$filePath) {
$filePath = $this->getContainer()->getParameter('kernel.root_dir') . '/../' . sprintf('%s-export.json', $user->getUsername()); $filePath = $this->getContainer()->getParameter('kernel.project_dir') . '/' . sprintf('%s-export.json', $user->getUsername());
} }
try { try {

View file

@ -205,7 +205,7 @@ services:
class: Wallabag\CoreBundle\Helper\DownloadImages class: Wallabag\CoreBundle\Helper\DownloadImages
arguments: arguments:
- "@wallabag_core.entry.download_images.client" - "@wallabag_core.entry.download_images.client"
- "%kernel.root_dir%/../web/assets/images" - "%kernel.project_dir%/web/assets/images"
- '%domain_name%' - '%domain_name%'
- "@logger" - "@logger"

View file

@ -74,7 +74,7 @@ class ImportCommandTest extends WallabagCoreTestCase
$tester->execute([ $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
'username' => 'admin', 'username' => 'admin',
'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir') . '/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
'--importer' => 'v2', '--importer' => 'v2',
]); ]);
@ -93,7 +93,7 @@ class ImportCommandTest extends WallabagCoreTestCase
$tester->execute([ $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
'username' => 1, 'username' => 1,
'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir') . '/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
'--useUserId' => true, '--useUserId' => true,
'--importer' => 'v2', '--importer' => 'v2',
]); ]);