Skip to content

Commit 71c03a8

Browse files
Merge branch '6.4' into 7.0
* 6.4: (33 commits) [Console][FrameworkBundle][HttpKernel][WebProfilerBundle] Enable profiling commands [AssetMapper] Disable profiler when the "dev server" respond Adds translations for Portuguese (pt) [AssetMapper] Link needs as="style" Allow Symfony 7.0 on Phrase translation provider [Mime] Throw InvalidArgumentException on invalid form field type inside array [Mailer][Bridges] Allow Symfony 7 [Tests] Use `JsonMockResponse` where applicable [FrameworkBundle][HttpKernel] Introduce `$buildDir` argument to `WarmableInterface::warmup` to warm read-only artefacts in `build_dir` [ErrorHandler] Fix expected missing return types [Form] Fix merging params & files when "multiple" is enabled [HttpFoundation] Do not swallow trailing `=` in cookie value Fix markdown in README files Handle Sendinblue error responses without a message key Handle Brevo error responses without a message key [Scheduler] Add failureEvent [Notifier][Bridges] Allow Symfony 7 [Mailer][Brevo][Sendinblue] Fix typo [Serializer] Fix collecting only first missing constructor argument [ErrorHandler] Fix file link format call in trace view ...
2 parents 3a2a2d9 + 11de26c commit 71c03a8

30 files changed

+287
-67
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ CHANGELOG
5555
* Deprecate the `framework.asset_mapper.provider` config option
5656
* Add `--exclude` option to the `cache:pool:clear` command
5757
* Add parameters deprecations to the output of `debug:container` command
58+
* Change `framework.asset_mapper.importmap_polyfill` from a URL to the name of an item in the importmap
59+
* Provide `$buildDir` when running `CacheWarmer` to build read-only resources
60+
* Add the global `--profile` option to the console to enable profiling commands
5861

5962
6.3
6063
---

CacheWarmer/AbstractPhpFileCacheWarmer.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,13 @@ public function isOptional(): bool
3434
return true;
3535
}
3636

37-
/**
38-
* @return string[] A list of classes to preload on PHP 7.4+
39-
*/
40-
public function warmUp(string $cacheDir): array
37+
public function warmUp(string $cacheDir, string $buildDir = null): array
4138
{
4239
$arrayAdapter = new ArrayAdapter();
4340

4441
spl_autoload_register([ClassExistenceResource::class, 'throwOnRequiredClass']);
4542
try {
46-
if (!$this->doWarmUp($cacheDir, $arrayAdapter)) {
43+
if (!$this->doWarmUp($cacheDir, $arrayAdapter, $buildDir)) {
4744
return [];
4845
}
4946
} finally {
@@ -80,5 +77,5 @@ final protected function ignoreAutoloadException(string $class, \Exception $exce
8077
/**
8178
* @return bool false if there is nothing to warm-up
8279
*/
83-
abstract protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter): bool;
80+
abstract protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, string $buildDir = null): bool;
8481
}

CacheWarmer/CachePoolClearerCacheWarmer.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ public function __construct(Psr6CacheClearer $poolClearer, array $pools = [])
3737
$this->pools = $pools;
3838
}
3939

40-
/**
41-
* @return string[]
42-
*/
43-
public function warmUp(string $cacheDirectory): array
40+
public function warmUp(string $cacheDir, string $buildDir = null): array
4441
{
4542
foreach ($this->pools as $pool) {
4643
if ($this->poolClearer->hasPool($pool)) {

CacheWarmer/ConfigBuilderCacheWarmer.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ public function __construct(KernelInterface $kernel, LoggerInterface $logger = n
3737
$this->logger = $logger;
3838
}
3939

40-
/**
41-
* @return string[]
42-
*/
43-
public function warmUp(string $cacheDir): array
40+
public function warmUp(string $cacheDir, string $buildDir = null): array
4441
{
45-
$generator = new ConfigBuilderGenerator($this->kernel->getBuildDir());
42+
if (!$buildDir) {
43+
return [];
44+
}
45+
46+
$generator = new ConfigBuilderGenerator($buildDir);
4647

4748
foreach ($this->kernel->getBundles() as $bundle) {
4849
$extension = $bundle->getContainerExtension();

CacheWarmer/RouterCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public function __construct(ContainerInterface $container)
3434
$this->container = $container;
3535
}
3636

37-
public function warmUp(string $cacheDir): array
37+
public function warmUp(string $cacheDir, string $buildDir = null): array
3838
{
3939
$router = $this->container->get('router');
4040

4141
if ($router instanceof WarmableInterface) {
42-
return (array) $router->warmUp($cacheDir);
42+
return (array) $router->warmUp($cacheDir, $buildDir);
4343
}
4444

4545
throw new \LogicException(sprintf('The router "%s" cannot be warmed up because it does not implement "%s".', get_debug_type($router), WarmableInterface::class));

CacheWarmer/SerializerCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(array $loaders, string $phpArrayFile)
3939
$this->loaders = $loaders;
4040
}
4141

42-
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter): bool
42+
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, string $buildDir = null): bool
4343
{
4444
if (!$this->loaders) {
4545
return true;

CacheWarmer/TranslationsCacheWarmer.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,12 @@ public function __construct(ContainerInterface $container)
3333
$this->container = $container;
3434
}
3535

36-
/**
37-
* @return string[]
38-
*/
39-
public function warmUp(string $cacheDir): array
36+
public function warmUp(string $cacheDir, string $buildDir = null): array
4037
{
4138
$this->translator ??= $this->container->get('translator');
4239

4340
if ($this->translator instanceof WarmableInterface) {
44-
return (array) $this->translator->warmUp($cacheDir);
41+
return (array) $this->translator->warmUp($cacheDir, $buildDir);
4542
}
4643

4744
return [];

CacheWarmer/ValidatorCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(ValidatorBuilder $validatorBuilder, string $phpArray
3939
$this->validatorBuilder = $validatorBuilder;
4040
}
4141

42-
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter): bool
42+
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, string $buildDir = null): bool
4343
{
4444
$loaders = $this->validatorBuilder->getLoaders();
4545
$metadataFactory = new LazyLoadingMetadataFactory(new LoaderChain($loaders), $arrayAdapter);

Command/CacheClearCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ private function warmupOptionals(string $cacheDir, string $warmupDir, SymfonySty
245245
$warmer = $kernel->getContainer()->get('cache_warmer');
246246
// non optional warmers already ran during container compilation
247247
$warmer->enableOnlyOptionalWarmers();
248-
$preload = (array) $warmer->warmUp($cacheDir, $io);
248+
$preload = (array) $warmer->warmUp($cacheDir, $warmupDir, $io);
249249

250250
if ($preload && file_exists($preloadFile = $warmupDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
251251
Preloader::append($preloadFile, $preload);

Command/CacheWarmupCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7474

7575
$preload = $this->cacheWarmer->warmUp($cacheDir);
7676

77-
if ($preload && file_exists($preloadFile = $cacheDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
77+
$buildDir = $kernel->getContainer()->getParameter('kernel.build_dir');
78+
if ($preload && $cacheDir === $buildDir && file_exists($preloadFile = $buildDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
7879
Preloader::append($preloadFile, $preload);
7980
}
8081

0 commit comments

Comments
 (0)