5 * Contains database additions to drupal-8.eu-cookie-compliance-beta5.minimal.php.gz
6 * for testing the upgrade path of https://www.drupal.org/node/2774143.
9 use Drupal\Component\Serialization\Yaml;
10 use Drupal\Core\Database\Database;
12 $connection = Database::getConnection();
14 // A custom role with 'administer EU Cookie Compliance popup' permissions.
15 $role_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/user.role.testfor2774143.yml'));
17 // A custom role with 'display EU Cookie Compliance popup' permissions.
18 $role_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/user.role.secondtestfor2774143.yml'));
20 foreach ($role_configs as $role_config) {
21 $connection->insert('config')
29 'name' => 'user.role.' . $role_config['id'],
30 'data' => serialize($role_config),
35 // Update the config entity query "index".
36 $existing_roles = $connection->select('key_value')
37 ->fields('key_value', ['value'])
38 ->condition('collection', 'config.entity.key_store.user_role')
41 $existing_roles = unserialize($existing_roles);
43 $connection->update('key_value')
45 'value' => serialize(array_merge($existing_roles, ['user.role.testfor2774143', 'user.role.secondtestfor2774143']))
47 ->condition('collection', 'config.entity.key_store.user_role')
48 ->condition('name', 'theme:bartik')