Skip to content

Commit 5a7d0d0

Browse files
committed
feature #37114 Provides a way to override cache and log folders from the ENV (Plopix)
This PR was merged into the 5.2-dev branch. Discussion ---------- Provides a way to override cache and log folders from the ENV | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | License | MIT When using Docker and especially on Mac OS X, performances are terrible when using a "mount" on the host inside the container. (which happens by default) To optimize the performances, one of the tricks is to change where the application is going to write the cache and the logs. This PR provides a new env variables `APP_CACHE_DIR` and `APP_LOG_DIR` which can be set to change where will be saved the caches and the logs. I know we can do it per project BUT: - I think that is a good addition to Symfony - it would allow project like eZ Platform and eZ Launchpad to automate that optimization ezsystems/ezplatform#543 Let me know Commits ------- 5fa5d36153 Provides a way to override cache and log folders form the ENV
2 parents 2fe5a74 + 2b637cb commit 5a7d0d0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Kernel/MicroKernelTrait.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ trait MicroKernelTrait
6363
*/
6464
//abstract protected function configureContainer(ContainerConfigurator $c): void;
6565

66+
/**
67+
* {@inheritdoc}
68+
*/
69+
public function getCacheDir(): string
70+
{
71+
return $_SERVER['APP_CACHE_DIR'] ?? parent::getCacheDir();
72+
}
73+
74+
/**
75+
* {@inheritdoc}
76+
*/
77+
public function getLogDir(): string
78+
{
79+
return $_SERVER['APP_LOG_DIR'] ?? parent::getLogDir();
80+
}
81+
6682
/**
6783
* {@inheritdoc}
6884
*/

0 commit comments

Comments
 (0)