Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\Update;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\DependencyInjection\ContainerBuilder;
|
Chris@0
|
6 use Drupal\Core\DependencyInjection\ServiceModifierInterface;
|
Chris@0
|
7 use Drupal\Core\DependencyInjection\ServiceProviderInterface;
|
Chris@0
|
8 use Symfony\Component\DependencyInjection\Definition;
|
Chris@0
|
9 use Symfony\Component\DependencyInjection\Reference;
|
Chris@0
|
10
|
Chris@0
|
11 /**
|
Chris@0
|
12 * Ensures for some services that they don't cache.
|
Chris@0
|
13 */
|
Chris@0
|
14 class UpdateServiceProvider implements ServiceProviderInterface, ServiceModifierInterface {
|
Chris@0
|
15
|
Chris@0
|
16 /**
|
Chris@0
|
17 * {@inheritdoc}
|
Chris@0
|
18 */
|
Chris@0
|
19 public function register(ContainerBuilder $container) {
|
Chris@0
|
20 $definition = new Definition('Drupal\Core\Cache\NullBackend', ['null']);
|
Chris@0
|
21 $container->setDefinition('cache.null', $definition);
|
Chris@0
|
22 }
|
Chris@0
|
23
|
Chris@0
|
24 /**
|
Chris@0
|
25 * {@inheritdoc}
|
Chris@0
|
26 */
|
Chris@0
|
27 public function alter(ContainerBuilder $container) {
|
Chris@0
|
28 $definition = $container->getDefinition('asset.resolver');
|
Chris@0
|
29 $argument = new Reference('cache.null');
|
Chris@0
|
30 $definition->replaceArgument(5, $argument);
|
Chris@0
|
31
|
Chris@0
|
32 $definition = $container->getDefinition('library.discovery.collector');
|
Chris@0
|
33 $argument = new Reference('cache.null');
|
Chris@0
|
34 $definition->replaceArgument(0, $argument);
|
Chris@18
|
35
|
Chris@18
|
36 // Prevent the alias-based path processor, which requires a path_alias db
|
Chris@18
|
37 // table, from being registered to the path processor manager. We do this by
|
Chris@18
|
38 // removing the tags that the compiler pass looks for. This means the url
|
Chris@18
|
39 // generator can safely be used during the database update process.
|
Chris@18
|
40 if ($container->hasDefinition('path_processor_alias')) {
|
Chris@18
|
41 $container->getDefinition('path_processor_alias')
|
Chris@18
|
42 ->clearTag('path_processor_inbound')
|
Chris@18
|
43 ->clearTag('path_processor_outbound');
|
Chris@18
|
44 }
|
Chris@0
|
45 }
|
Chris@0
|
46
|
Chris@0
|
47 }
|