Skip to content

Commit 60416a2

Browse files
[HttpKernel] allow cache warmers to add to the list of preloaded classes and files
1 parent 1ae8d6a commit 60416a2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

CacheWarmer/ProxyCacheWarmer.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ public function isOptional()
4343

4444
/**
4545
* {@inheritdoc}
46+
*
47+
* @return string[] A list of files to preload on PHP 7.4+
4648
*/
4749
public function warmUp(string $cacheDir)
4850
{
51+
$files = [];
4952
foreach ($this->registry->getManagers() as $em) {
5053
// we need the directory no matter the proxy cache generation strategy
5154
if (!is_dir($proxyCacheDir = $em->getConfiguration()->getProxyDir())) {
@@ -64,6 +67,14 @@ public function warmUp(string $cacheDir)
6467
$classes = $em->getMetadataFactory()->getAllMetadata();
6568

6669
$em->getProxyFactory()->generateProxyClasses($classes);
70+
71+
foreach (scandir($proxyCacheDir) as $file) {
72+
if (!is_dir($file = $proxyCacheDir.'/'.$file)) {
73+
$files[] = $file;
74+
}
75+
}
6776
}
77+
78+
return $files;
6879
}
6980
}

0 commit comments

Comments
 (0)