Skip to content

Commit

Permalink
[Task]: Make symfony/dotenv package optional (pimcore#14117)
Browse files Browse the repository at this point in the history
* Make symfony/dotenv package optional - resolves pimcore#11411
* Make symfony/dotenv package optional - review changes
  • Loading branch information
dvesh3 authored Feb 7, 2023
1 parent 64e31db commit 98a5bf1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/ci/scripts/symfony-require-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -eu

composer require --no-update symfony/asset:${SYMFONY_VERSION} symfony/cache:${SYMFONY_VERSION} symfony/doctrine-messenger:${SYMFONY_VERSION} symfony/config:${SYMFONY_VERSION} symfony/console:${SYMFONY_VERSION} symfony/dependency-injection:${SYMFONY_VERSION} symfony/debug-bundle:${SYMFONY_VERSION} symfony/dom-crawler:${SYMFONY_VERSION} symfony/dotenv:${SYMFONY_VERSION} symfony/error-handler:${SYMFONY_VERSION} symfony/event-dispatcher:${SYMFONY_VERSION} symfony/expression-language:${SYMFONY_VERSION} symfony/filesystem:${SYMFONY_VERSION} symfony/finder:${SYMFONY_VERSION} symfony/form:${SYMFONY_VERSION} symfony/framework-bundle:${SYMFONY_VERSION} symfony/http-foundation:${SYMFONY_VERSION} symfony/http-kernel:${SYMFONY_VERSION} symfony/lock:${SYMFONY_VERSION} symfony/mailer:${SYMFONY_VERSION} symfony/messenger:${SYMFONY_VERSION} symfony/mime:${SYMFONY_VERSION} symfony/options-resolver:${SYMFONY_VERSION} symfony/password-hasher:${SYMFONY_VERSION} symfony/process:${SYMFONY_VERSION} symfony/property-access:${SYMFONY_VERSION} symfony/rate-limiter:${SYMFONY_VERSION} symfony/routing:${SYMFONY_VERSION} symfony/security-bundle:${SYMFONY_VERSION} symfony/security-core:${SYMFONY_VERSION} symfony/security-http:${SYMFONY_VERSION} symfony/serializer:${SYMFONY_VERSION} symfony/stopwatch:${SYMFONY_VERSION} symfony/templating:${SYMFONY_VERSION} symfony/translation:${SYMFONY_VERSION} symfony/twig-bridge:${SYMFONY_VERSION} symfony/twig-bundle:${SYMFONY_VERSION} symfony/uid:${SYMFONY_VERSION} symfony/validator:${SYMFONY_VERSION} symfony/var-dumper:${SYMFONY_VERSION} symfony/web-link:${SYMFONY_VERSION} symfony/web-profiler-bundle:${SYMFONY_VERSION} symfony/workflow:${SYMFONY_VERSION} symfony/yaml:${SYMFONY_VERSION}
composer require --no-update symfony/asset:${SYMFONY_VERSION} symfony/cache:${SYMFONY_VERSION} symfony/doctrine-messenger:${SYMFONY_VERSION} symfony/config:${SYMFONY_VERSION} symfony/console:${SYMFONY_VERSION} symfony/dependency-injection:${SYMFONY_VERSION} symfony/debug-bundle:${SYMFONY_VERSION} symfony/dom-crawler:${SYMFONY_VERSION} symfony/error-handler:${SYMFONY_VERSION} symfony/event-dispatcher:${SYMFONY_VERSION} symfony/expression-language:${SYMFONY_VERSION} symfony/filesystem:${SYMFONY_VERSION} symfony/finder:${SYMFONY_VERSION} symfony/form:${SYMFONY_VERSION} symfony/framework-bundle:${SYMFONY_VERSION} symfony/http-foundation:${SYMFONY_VERSION} symfony/http-kernel:${SYMFONY_VERSION} symfony/lock:${SYMFONY_VERSION} symfony/mailer:${SYMFONY_VERSION} symfony/messenger:${SYMFONY_VERSION} symfony/mime:${SYMFONY_VERSION} symfony/options-resolver:${SYMFONY_VERSION} symfony/password-hasher:${SYMFONY_VERSION} symfony/process:${SYMFONY_VERSION} symfony/property-access:${SYMFONY_VERSION} symfony/rate-limiter:${SYMFONY_VERSION} symfony/routing:${SYMFONY_VERSION} symfony/security-bundle:${SYMFONY_VERSION} symfony/security-core:${SYMFONY_VERSION} symfony/security-http:${SYMFONY_VERSION} symfony/serializer:${SYMFONY_VERSION} symfony/stopwatch:${SYMFONY_VERSION} symfony/templating:${SYMFONY_VERSION} symfony/translation:${SYMFONY_VERSION} symfony/twig-bridge:${SYMFONY_VERSION} symfony/twig-bundle:${SYMFONY_VERSION} symfony/uid:${SYMFONY_VERSION} symfony/validator:${SYMFONY_VERSION} symfony/var-dumper:${SYMFONY_VERSION} symfony/web-link:${SYMFONY_VERSION} symfony/web-profiler-bundle:${SYMFONY_VERSION} symfony/workflow:${SYMFONY_VERSION} symfony/yaml:${SYMFONY_VERSION}
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"symfony/dependency-injection": "^6.1",
"symfony/debug-bundle": "^6.1",
"symfony/dom-crawler": "^6.1",
"symfony/dotenv": "^6.1",
"symfony/error-handler": "^6.1",
"symfony/event-dispatcher": "^6.1",
"symfony/expression-language": "^6.1",
Expand Down Expand Up @@ -158,7 +157,8 @@
"spiritix/php-chrome-html2pdf": "^1.6",
"composer/composer": "*",
"chrome-php/chrome": "^1.4.0",
"webmozarts/console-parallelization": "^2.1"
"webmozarts/console-parallelization": "^2.1",
"symfony/dotenv": "^6.1"
},
"suggest": {
"ext-sockets": "*",
Expand All @@ -167,7 +167,8 @@
"spiritix/php-chrome-html2pdf": "Required for the Headless Chrome Web2Print Extension",
"elasticsearch/elasticsearch": "Required for Elastic Search service",
"chrome-php/chrome": "Required for Documents Page Previews",
"webmozarts/console-parallelization": "Required for parallelization of console commands"
"webmozarts/console-parallelization": "Required for parallelization of console commands",
"symfony/dotenv": "Required for loading environment vars from .env files"
},
"autoload": {
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ Please make sure to set your preferred storage location ***before*** migration.
instead of `pimcore_core`. please add option `pimcore_asset_update` to command `bin/console messenger:consume pimcore_core... pimcore_asset_update` to post process assets on update.
Also run command `bin/console messenger:consume pimcore_core` before the upgrade, so that `AssetUpdateTasksMessage` on the queue gets consumed.
- [Events] Event `pimcore.element.note.postAdd` has been removed. Use `pimcore.note.postAdd` instead. Note: The event type changed from `ElementEvent` to `ModelEvent`.
- [Environment] - Removed `symfony/dotenv` dependency to make loading of `.env` files optional. please add the requirement to your composer.json, if you still want to use `.env` files.


## 10.6.0
- [Session] The `getHandler`, `setHandler`, `useSession`, `getSessionId`, `getSessionName`, `invalidate`, `regenerateId`, `requestHasSessionId`, `getSessionIdFromRequest`, `get`, `getReadOnly` and `writeClose` methods of `Pimcore\Tool\Session` and class `PreAuthenticatedAdminSessionFactory` are deprecated and get removed with Pimcore 11. Session Management will be handled by Symfony in Pimcore 11.
Expand Down
2 changes: 1 addition & 1 deletion lib/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public static function kernel(): Kernel|\App\Kernel|KernelInterface
{
$environment = Config::getEnvironment();

$debug = (bool) ($_SERVER['APP_DEBUG'] ?? false);
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? $environment !== 'prod');
if ($debug) {
umask(0000);
Debug::enable();
Expand Down
2 changes: 1 addition & 1 deletion lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public static function inPerspective(array $runtimeConfig, string $key): bool

public static function getEnvironment(): string
{
return $_SERVER['APP_ENV'];
return $_SERVER['APP_ENV'] ?? 'dev';
}

/**
Expand Down

0 comments on commit 98a5bf1

Please sign in to comment.