Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/system/tests/fixtures/update/drupal-8.actions-2815379.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | |
2 | |
3 /** | |
4 * @file | |
5 * Contains database additions to for testing upgrade path for action plugins. | |
6 * | |
7 * @see https://www.drupal.org/node/2815379 | |
8 */ | |
9 | |
10 use Drupal\Core\Database\Database; | |
11 use Drupal\Core\Serialization\Yaml; | |
12 | |
13 $connection = Database::getConnection(); | |
14 | |
15 // Structure of configured email, goto, and message actions. | |
16 $actions[] = Yaml::decode(file_get_contents(__DIR__ . '/system.action.goto_2815379.yml')); | |
17 $actions[] = Yaml::decode(file_get_contents(__DIR__ . '/system.action.message_2815379.yml')); | |
18 $actions[] = Yaml::decode(file_get_contents(__DIR__ . '/system.action.send_email_2815379.yml')); | |
19 | |
20 foreach ($actions as $action) { | |
21 $connection->insert('config') | |
22 ->fields([ | |
23 'collection', | |
24 'name', | |
25 'data', | |
26 ]) | |
27 ->values([ | |
28 'collection' => '', | |
29 'name' => 'system.action.' . $action['id'], | |
30 'data' => serialize($action), | |
31 ]) | |
32 ->execute(); | |
33 } | |
34 | |
35 // Enable action module. | |
36 $extensions = $connection->select('config') | |
37 ->fields('config', ['data']) | |
38 ->condition('name', 'core.extension') | |
39 ->execute() | |
40 ->fetchField(); | |
41 $extensions = unserialize($extensions); | |
42 $connection->update('config') | |
43 ->fields([ | |
44 'data' => serialize(array_merge_recursive($extensions, ['module' => ['action' => 0]])), | |
45 ]) | |
46 ->condition('name', 'core.extension') | |
47 ->execute(); |