mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-11 09:23:50 +09:00
Update dependencies
This commit is contained in:
@@ -29,33 +29,6 @@ use Symfony\Component\DependencyInjection\Reference;
|
||||
*/
|
||||
class CachePoolPass implements CompilerPassInterface
|
||||
{
|
||||
private $cachePoolTag;
|
||||
private $kernelResetTag;
|
||||
private $cacheClearerId;
|
||||
private $cachePoolClearerTag;
|
||||
private $cacheSystemClearerId;
|
||||
private $cacheSystemClearerTag;
|
||||
private $reverseContainerId;
|
||||
private $reversibleTag;
|
||||
private $messageHandlerId;
|
||||
|
||||
public function __construct(string $cachePoolTag = 'cache.pool', string $kernelResetTag = 'kernel.reset', string $cacheClearerId = 'cache.global_clearer', string $cachePoolClearerTag = 'cache.pool.clearer', string $cacheSystemClearerId = 'cache.system_clearer', string $cacheSystemClearerTag = 'kernel.cache_clearer', string $reverseContainerId = 'reverse_container', string $reversibleTag = 'container.reversible', string $messageHandlerId = 'cache.early_expiration_handler')
|
||||
{
|
||||
if (0 < \func_num_args()) {
|
||||
trigger_deprecation('symfony/cache', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
|
||||
}
|
||||
|
||||
$this->cachePoolTag = $cachePoolTag;
|
||||
$this->kernelResetTag = $kernelResetTag;
|
||||
$this->cacheClearerId = $cacheClearerId;
|
||||
$this->cachePoolClearerTag = $cachePoolClearerTag;
|
||||
$this->cacheSystemClearerId = $cacheSystemClearerId;
|
||||
$this->cacheSystemClearerTag = $cacheSystemClearerTag;
|
||||
$this->reverseContainerId = $reverseContainerId;
|
||||
$this->reversibleTag = $reversibleTag;
|
||||
$this->messageHandlerId = $messageHandlerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -79,7 +52,7 @@ class CachePoolPass implements CompilerPassInterface
|
||||
'early_expiration_message_bus',
|
||||
'reset',
|
||||
];
|
||||
foreach ($container->findTaggedServiceIds($this->cachePoolTag) as $id => $tags) {
|
||||
foreach ($container->findTaggedServiceIds('cache.pool') as $id => $tags) {
|
||||
$adapter = $pool = $container->getDefinition($id);
|
||||
if ($pool->isAbstract()) {
|
||||
continue;
|
||||
@@ -88,7 +61,7 @@ class CachePoolPass implements CompilerPassInterface
|
||||
while ($adapter instanceof ChildDefinition) {
|
||||
$adapter = $container->findDefinition($adapter->getParent());
|
||||
$class = $class ?: $adapter->getClass();
|
||||
if ($t = $adapter->getTag($this->cachePoolTag)) {
|
||||
if ($t = $adapter->getTag('cache.pool')) {
|
||||
$tags[0] += $t[0];
|
||||
}
|
||||
}
|
||||
@@ -130,7 +103,7 @@ class CachePoolPass implements CompilerPassInterface
|
||||
while ($adapter instanceof ChildDefinition) {
|
||||
$adapter = $container->findDefinition($adapter->getParent());
|
||||
$chainedClass = $chainedClass ?: $adapter->getClass();
|
||||
if ($t = $adapter->getTag($this->cachePoolTag)) {
|
||||
if ($t = $adapter->getTag('cache.pool')) {
|
||||
$chainedTags[0] += $t[0];
|
||||
}
|
||||
}
|
||||
@@ -168,19 +141,19 @@ class CachePoolPass implements CompilerPassInterface
|
||||
// no-op
|
||||
} elseif ('reset' === $attr) {
|
||||
if ($tags[0][$attr]) {
|
||||
$pool->addTag($this->kernelResetTag, ['method' => $tags[0][$attr]]);
|
||||
$pool->addTag('kernel.reset', ['method' => $tags[0][$attr]]);
|
||||
}
|
||||
} elseif ('early_expiration_message_bus' === $attr) {
|
||||
$needsMessageHandler = true;
|
||||
$pool->addMethodCall('setCallbackWrapper', [(new Definition(EarlyExpirationDispatcher::class))
|
||||
->addArgument(new Reference($tags[0]['early_expiration_message_bus']))
|
||||
->addArgument(new Reference($this->reverseContainerId))
|
||||
->addArgument(new Reference('reverse_container'))
|
||||
->addArgument((new Definition('callable'))
|
||||
->setFactory([new Reference($id), 'setCallbackWrapper'])
|
||||
->addArgument(null)
|
||||
),
|
||||
]);
|
||||
$pool->addTag($this->reversibleTag);
|
||||
$pool->addTag('container.reversible');
|
||||
} elseif ('namespace' !== $attr || !\in_array($class, [ArrayAdapter::class, NullAdapter::class], true)) {
|
||||
$argument = $tags[0][$attr];
|
||||
|
||||
@@ -194,7 +167,7 @@ class CachePoolPass implements CompilerPassInterface
|
||||
unset($tags[0][$attr]);
|
||||
}
|
||||
if (!empty($tags[0])) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid "%s" tag for service "%s": accepted attributes are "clearer", "provider", "name", "namespace", "default_lifetime", "early_expiration_message_bus" and "reset", found "%s".', $this->cachePoolTag, $id, implode('", "', array_keys($tags[0]))));
|
||||
throw new InvalidArgumentException(sprintf('Invalid "cache.pool" tag for service "%s": accepted attributes are "clearer", "provider", "name", "namespace", "default_lifetime", "early_expiration_message_bus" and "reset", found "%s".', $id, implode('", "', array_keys($tags[0]))));
|
||||
}
|
||||
|
||||
if (null !== $clearer) {
|
||||
@@ -205,14 +178,14 @@ class CachePoolPass implements CompilerPassInterface
|
||||
}
|
||||
|
||||
if (!$needsMessageHandler) {
|
||||
$container->removeDefinition($this->messageHandlerId);
|
||||
$container->removeDefinition('cache.early_expiration_handler');
|
||||
}
|
||||
|
||||
$notAliasedCacheClearerId = $this->cacheClearerId;
|
||||
while ($container->hasAlias($this->cacheClearerId)) {
|
||||
$this->cacheClearerId = (string) $container->getAlias($this->cacheClearerId);
|
||||
$notAliasedCacheClearerId = $aliasedCacheClearerId = 'cache.global_clearer';
|
||||
while ($container->hasAlias('cache.global_clearer')) {
|
||||
$aliasedCacheClearerId = (string) $container->getAlias('cache.global_clearer');
|
||||
}
|
||||
if ($container->hasDefinition($this->cacheClearerId)) {
|
||||
if ($container->hasDefinition($aliasedCacheClearerId)) {
|
||||
$clearers[$notAliasedCacheClearerId] = $allPools;
|
||||
}
|
||||
|
||||
@@ -223,10 +196,10 @@ class CachePoolPass implements CompilerPassInterface
|
||||
} else {
|
||||
$clearer->setArgument(0, $pools);
|
||||
}
|
||||
$clearer->addTag($this->cachePoolClearerTag);
|
||||
$clearer->addTag('cache.pool.clearer');
|
||||
|
||||
if ($this->cacheSystemClearerId === $id) {
|
||||
$clearer->addTag($this->cacheSystemClearerTag);
|
||||
if ('cache.system_clearer' === $id) {
|
||||
$clearer->addTag('kernel.cache_clearer');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user