
| Current Path : /var/www/html1/testsite/web/core/modules/system/tests/fixtures/update/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html1/testsite/web/core/modules/system/tests/fixtures/update/drupal-8.actions-2815379.php |
<?php
/**
* @file
* Contains database additions to for testing upgrade path for action plugins.
*
* @see https://www.drupal.org/node/2815379
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
// Structure of configured email, goto, and message actions.
$actions[] = Yaml::decode(file_get_contents(__DIR__ . '/system.action.goto_2815379.yml'));
$actions[] = Yaml::decode(file_get_contents(__DIR__ . '/system.action.message_2815379.yml'));
$actions[] = Yaml::decode(file_get_contents(__DIR__ . '/system.action.send_email_2815379.yml'));
foreach ($actions as $action) {
$connection->insert('config')
->fields([
'collection',
'name',
'data',
])
->values([
'collection' => '',
'name' => 'system.action.' . $action['id'],
'data' => serialize($action),
])
->execute();
}
// Enable action module.
$extensions = $connection->select('config')
->fields('config', ['data'])
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$connection->update('config')
->fields([
'data' => serialize(array_merge_recursive($extensions, ['module' => ['action' => 0]])),
])
->condition('name', 'core.extension')
->execute();