Skip to content

Commit 3fc7d5f

Browse files
committed
minor #11496 HTTP Cache - update for index.php snippet (broiniac)
This PR was merged into the 4.2 branch. Discussion ---------- HTTP Cache - update for index.php snippet New index.php does not contains `$env` variable. Some developers might copy-paste blindly (like I did) and waste some time figuring-out why CacheKernel is not in use even when app is in `prod`. Commits ------- 660fc83 Update for index.php snippet
2 parents 7ae7704 + 660fc83 commit 3fc7d5f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

http_cache.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,9 @@ caching kernel:
9999
use App\Kernel;
100100
101101
// ...
102-
$env = $_SERVER['APP_ENV'] ?? 'dev';
103-
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));
104-
// ...
105-
$kernel = new Kernel($env, $debug);
106-
102+
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
107103
+ // Wrap the default Kernel with the CacheKernel one in 'prod' environment
108-
+ if ('prod' === $env) {
104+
+ if ('prod' === $kernel->getEnvironment()) {
109105
+ $kernel = new CacheKernel($kernel);
110106
+ }
111107

0 commit comments

Comments
 (0)