diff --git a/.gitignore b/.gitignore index 1693d1b686..169b47c65c 100755 --- a/.gitignore +++ b/.gitignore @@ -58,8 +58,10 @@ symfony.lock /.env.local /.env.local.php /.env.*.local +/config/secrets/prod/prod.decrypt.private.php /public/bundles/ -/vendor +/var/ +/vendor/ ###< symfony/framework-bundle ### ###> friendsofphp/php-cs-fixer ### @@ -82,3 +84,8 @@ symfony.lock npm-debug.log yarn-error.log ###< symfony/webpack-encore-bundle ### + +###> squizlabs/php_codesniffer ### +/.phpcs-cache +/phpcs.xml +###< squizlabs/php_codesniffer ### diff --git a/config/bootstrap.php b/config/bootstrap.php index f6afb40429..976a776397 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -6,16 +6,18 @@ require dirname(__DIR__).'/vendor/autoload.php'; // Load cached env vars if the .env.local.php file exists // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) -if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { - $_SERVER += $env; - $_ENV += $env; +if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV']) { + foreach ($env as $k => $v) { + $_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v); + } } elseif (!class_exists(Dotenv::class)) { throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } else { // load all the .env files - (new Dotenv())->loadEnv(dirname(__DIR__).'/.env'); + (new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env'); } +$_SERVER += $_ENV; $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/src/Kernel.php b/src/Kernel.php index b0d3831012..a9dd647ccb 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -20,22 +20,6 @@ class Kernel extends BaseKernel public const CONFIG_EXTS = '.{php,xml,yaml,yml}'; - /** - * @return string - */ - public function getCacheDir() - { - return $this->getProjectDir().'/var/cache/'.$this->environment; - } - - /** - * @return string - */ - public function getLogDir() - { - return $this->getProjectDir().'/var/log'; - } - /** * @return \Generator|\Symfony\Component\HttpKernel\Bundle\BundleInterface[] */