-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TwigBundle] Use kernel.build_dir
to store the templates known at build time
#54384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.3
Are you sure you want to change the base?
Conversation
fb68b3c
to
0bc3774
Compare
0bc3774
to
c5b4ab0
Compare
src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
Outdated
Show resolved
Hide resolved
c5b4ab0
to
95b994c
Compare
src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good idea.
src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
Outdated
Show resolved
Hide resolved
0dbdd9b
to
40e485c
Compare
shouldn't this dual cache setup be disabled when autoReload is enabled ? Otherwise, any template cached in the readonly cache won't be reloaded (as the cache never writes the new content) which will break the DX |
I don't think it needs to. Looking at the |
40e485c
to
4289c16
Compare
5155bf6
to
3483575
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're close to the result we wanted. Do you want to continue @Okhoshi?
src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
Outdated
Show resolved
Hide resolved
5c7c0b8
to
bf25c25
Compare
src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
bf25c25
to
70757d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To summarize the configuration:
cache === false
: No cachecache is string path
: Filesystem cache using the configured path, warmed bycache:warmup
.cache === true && auto_reload === true
: (debug mode) Filesystem cache in the cache dir, warmed bycache:warmup
cache === true && auto_reload === false
: (prod mode) Read-only filesystem cache in the build dir warmed bycache:warmup
command, and filesystem cache in%kernel.cache_dir%/twig
for dynamic templates.
It would be perfect to add service definition tests for each configuration, using micro-kernels in the tests.
src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
Outdated
Show resolved
Hide resolved
70757d5
to
b55820e
Compare
b55820e
to
1a38f61
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it on a project and got some functional feedback.
src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
Outdated
Show resolved
Hide resolved
1a38f61
to
a0bbca5
Compare
Tests are failing.
|
…uild time Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
a0bbca5
to
0f841d2
Compare
Fixed, I didn't realise the tests were using a smaller kernel. |
Follow up to #50391, set up the Twig
TemplateCacheWarmer
to use thekernel.build_dir
instead ofkernel.cache_dir
. A new argument is added to its constructor to specify the directory to use for the cache.