Skip to content

Commit

Permalink
Replace kernel.root_dir by kernel.project_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
yguedidi committed Aug 7, 2023
1 parent 9870785 commit 3c0a0ca
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
7 changes: 1 addition & 6 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ public function registerBundles()
return $bundles;
}

public function getRootDir()
{
return __DIR__;
}

public function getCacheDir()
{
return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
Expand All @@ -79,7 +74,7 @@ public function getLogDir()

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) {
if ($container->getParameter('use_webpack_dev_server')) {
Expand Down
2 changes: 1 addition & 1 deletion app/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
autoconfigure: true
public: true
bind:
$rootDir: '%kernel.root_dir%'
$projectDir: '%kernel.project_dir%'
$debug: '%kernel.debug%'
$defaultLocale: '%kernel.default_locale%'
$wallabagUrl: '%domain_name%'
Expand Down
10 changes: 5 additions & 5 deletions app/config/webpack/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ const path = require('path');
const webpack = require('webpack');
const StyleLintPlugin = require('stylelint-webpack-plugin');

const rootDir = path.resolve(__dirname, '../../../');
const projectDir = path.resolve(__dirname, '../../../');

module.exports = {
entry: {
material: path.join(rootDir, './app/Resources/static/themes/material/index.js'),
public: path.join(rootDir, './app/Resources/static/themes/_global/share.js'),
material: path.join(projectDir, './app/Resources/static/themes/material/index.js'),
public: path.join(projectDir, './app/Resources/static/themes/_global/share.js'),
},
output: {
filename: '[name].js',
path: path.resolve(rootDir, 'web/wallassets'),
path: path.resolve(projectDir, 'web/wallassets'),
publicPath: '',
},
plugins: [
Expand All @@ -31,7 +31,7 @@ module.exports = {
],
resolve: {
alias: {
jquery: path.join(rootDir, 'node_modules/jquery/dist/jquery.js'),
jquery: path.join(projectDir, 'node_modules/jquery/dist/jquery.js'),
},
},
};
2 changes: 1 addition & 1 deletion docker/php/config/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
database_name: ${DATABASE_NAME:-symfony}
database_user: ${DATABASE_USER:-root}
database_password: ${DATABASE_PASSWORD:-~}
database_path: '${DATABASE_PATH:-"%kernel.root_dir%/data/db/wallabag.sqlite"}'
database_path: '${DATABASE_PATH:-"%kernel.project_dir%/data/db/wallabag.sqlite"}'
database_table_prefix: ${DATABASE_TABLE_PREFIX:-wallabag_}
database_socket: null
database_charset: ${DATABASE_CHARSET:-utf8}
Expand Down
8 changes: 4 additions & 4 deletions src/Wallabag/CoreBundle/Twig/WallabagExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
private $tagRepository;
private $lifeTime;
private $translator;
private $rootDir;
private $projectDir;

public function __construct(EntryRepository $entryRepository, TagRepository $tagRepository, TokenStorageInterface $tokenStorage, $lifeTime, TranslatorInterface $translator, string $rootDir)
public function __construct(EntryRepository $entryRepository, TagRepository $tagRepository, TokenStorageInterface $tokenStorage, $lifeTime, TranslatorInterface $translator, string $projectDir)
{
$this->entryRepository = $entryRepository;
$this->tagRepository = $tagRepository;
$this->tokenStorage = $tokenStorage;
$this->lifeTime = $lifeTime;
$this->translator = $translator;
$this->rootDir = $rootDir;
$this->projectDir = $projectDir;
}

public function getGlobals(): array
Expand Down Expand Up @@ -174,7 +174,7 @@ public function displayStats()

public function assetFileExists($name)
{
return file_exists(realpath($this->rootDir . '/../web/' . $name));
return file_exists(realpath($this->projectDir . '/web/' . $name));
}

public function themeClass()
Expand Down

0 comments on commit 3c0a0ca

Please sign in to comment.