Skip to content

Commit 872500f

Browse files
committed
minor #9933 Improved the front controller of the HttpCache (javiereguiluz)
This PR was squashed before being merged into the 4.0 branch (closes #9933). Discussion ---------- Improved the front controller of the HttpCache I don't think it makes sense to enable HttpCache in `dev` (in the past we only added this to `web/app.php` and not `web/app_dev.php`). The change in the `+ use App\CacheKernel;` (lines 98 and 99) is to sort the `use ...` alphabetically. Commits ------- 46c6c02 Improved the front controller of the HttpCache
2 parents 98eb88b + 46c6c02 commit 872500f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

http_cache.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,19 @@ caching kernel:
9595
9696
// public/index.php
9797
98-
use App\Kernel;
9998
+ use App\CacheKernel;
99+
use App\Kernel;
100100
101101
// ...
102-
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
102+
$env = $_SERVER['APP_ENV'] ?? 'dev';
103+
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));
104+
// ...
105+
$kernel = new Kernel($env, $debug);
103106
104-
+ // Wrap the default Kernel with the CacheKernel one
105-
+ $kernel = new CacheKernel($kernel);
107+
+ // Wrap the default Kernel with the CacheKernel one in 'prod' environment
108+
+ if ('prod' === $env) {
109+
+ $kernel = new CacheKernel($kernel);
110+
+ }
106111
107112
$request = Request::createFromGlobals();
108113
// ...

0 commit comments

Comments
 (0)