Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c95bd32

Browse filesBrowse files
[FrameworkBundle] Fix warming up routes
1 parent babd9be commit c95bd32
Copy full SHA for c95bd32

File tree

Expand file treeCollapse file tree

4 files changed

+12
-8
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+12
-8
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function warmUp(string $cacheDir, ?string $buildDir = null): array
5151

5252
public function isOptional(): bool
5353
{
54-
return true;
54+
return false;
5555
}
5656

5757
public static function getSubscribedServices(): array

‎src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getRouteCollection(): RouteCollection
6969
$this->collection->addResource(new ContainerParametersResource($this->collectedParameters));
7070

7171
try {
72-
$containerFile = ($this->paramFetcher)('kernel.cache_dir').'/'.($this->paramFetcher)('kernel.container_class').'.php';
72+
$containerFile = ($this->paramFetcher)('kernel.build_dir').'/'.($this->paramFetcher)('kernel.container_class').'.php';
7373
if (file_exists($containerFile)) {
7474
$this->collection->addResource(new FileResource($containerFile));
7575
} else {
@@ -84,14 +84,12 @@ public function getRouteCollection(): RouteCollection
8484

8585
public function warmUp(string $cacheDir, ?string $buildDir = null): array
8686
{
87-
if (!$buildDir) {
88-
return [];
87+
if (null === $currentDir = $this->getOption('cache_dir')) {
88+
return []; // skip warmUp when router doesn't use cache
8989
}
9090

91-
$currentDir = $this->getOption('cache_dir');
92-
93-
// force cache generation in build_dir
94-
$this->setOption('cache_dir', $buildDir);
91+
// force cache generation
92+
$this->setOption('cache_dir', $buildDir ?? $cacheDir);
9593
$this->getMatcher();
9694
$this->getGenerator();
9795

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/config/framework.yml
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ framework:
2121

2222
services:
2323
logger: { class: Psr\Log\NullLogger }
24+
25+
parameters:
26+
router.cache_dir: null

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/framework.yml
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ framework:
2222

2323
services:
2424
logger: { class: Psr\Log\NullLogger }
25+
26+
parameters:
27+
router.cache_dir: null

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.