5 * Contains database additions to drupal-8.bare.standard.php.gz for testing the
6 * upgrade path of https://www.drupal.org/node/2513534.
9 use Drupal\Component\Serialization\Yaml;
10 use Drupal\Core\Database\Database;
12 $connection = Database::getConnection();
15 $block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2513534.yml'));
17 // A block placed in the default region.
18 $block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2513534.yml'));
20 foreach ($block_configs as $block_config) {
21 $connection->insert('config')
29 'name' => 'block.block.' . $block_config['id'],
30 'data' => serialize($block_config),
35 // Update the config entity query "index".
36 $existing_blocks = $connection->select('key_value')
37 ->fields('key_value', ['value'])
38 ->condition('collection', 'config.entity.key_store.block')
39 ->condition('name', 'theme:bartik')
42 $existing_blocks = unserialize($existing_blocks);
44 $connection->update('key_value')
46 'value' => serialize(array_merge($existing_blocks, ['block.block.testfor2513534', 'block.block.secondtestfor2513534']))
48 ->condition('collection', 'config.entity.key_store.block')
49 ->condition('name', 'theme:bartik')