Version 1
[yaffs-website] / web / core / modules / system / tests / fixtures / update / drupal-8.config-override-fix.php
1 <?php
2
3 /**
4  * @file
5  * Partial database to create broken config overrides.
6  *
7  * @see \Drupal\system\Tests\Update\ConfigOverridesUpdateTest
8  */
9
10 use Drupal\Core\Database\Database;
11 use Symfony\Component\Yaml\Yaml;
12
13 $connection = Database::getConnection();
14
15 // Install the incorrect override configuration.
16 $configs = [
17   // The view has field titles translated and had an addition field added,
18   // translated and then removed.
19   'views.view.content',
20   // The configuration has a bogus key.
21   'system.cron',
22 ];
23 foreach ($configs as $config_name) {
24   $config = Yaml::parse(file_get_contents(__DIR__ . '/es-' . $config_name . '.yml'));
25   $connection->delete('config')
26     ->condition('name', $config_name)
27     ->condition('collection', 'language.es')
28     ->execute();
29   $connection->insert('config')
30     ->fields(['data', 'name', 'collection'])
31     ->values([
32       'name' => $config_name,
33       'data' => serialize($config),
34       'collection' => 'language.es',
35     ])
36     ->execute();
37 }