comparison core/lib/Drupal/Core/Installer/ConfigOverride.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents
children
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
1 <?php
2
3 namespace Drupal\Core\Installer;
4
5 use Drupal\Core\Cache\CacheableMetadata;
6 use Drupal\Core\Config\ConfigFactoryOverrideInterface;
7 use Drupal\Core\Config\StorageInterface;
8 use Drupal\Core\DependencyInjection\ContainerBuilder;
9 use Drupal\Core\DependencyInjection\ServiceProviderInterface;
10
11 /**
12 * Override configuration during the installer.
13 */
14 class ConfigOverride implements ServiceProviderInterface, ConfigFactoryOverrideInterface {
15
16 /**
17 * {@inheritdoc}
18 */
19 public function register(ContainerBuilder $container) {
20 // Register this class so that it can override configuration.
21 $container
22 ->register('core.install_config_override', static::class)
23 ->addTag('config.factory.override');
24 }
25
26 /**
27 * {@inheritdoc}
28 */
29 public function loadOverrides($names) {
30 $overrides = [];
31 if (drupal_installation_attempted() && function_exists('drupal_install_profile_distribution_name')) {
32 // Early in the installer the site name is unknown. In this case we need
33 // to fallback to the distribution's name.
34 $overrides['system.site'] = [
35 'name' => drupal_install_profile_distribution_name(),
36 ];
37 }
38 return $overrides;
39 }
40
41 /**
42 * {@inheritdoc}
43 */
44 public function getCacheSuffix() {
45 return 'core.install_config_override';
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
52 return NULL;
53 }
54
55 /**
56 * {@inheritdoc}
57 */
58 public function getCacheableMetadata($name) {
59 return new CacheableMetadata();
60 }
61
62 }