drupal-8.action-3022401.php 991 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * @file
  4. * Contains database additions to for testing upgrade path for action settings.
  5. *
  6. * @see https://www.drupal.org/node/3022401
  7. */
  8. use Drupal\Core\Database\Database;
  9. use Drupal\Core\Serialization\Yaml;
  10. $connection = Database::getConnection();
  11. $action_settings = Yaml::decode(file_get_contents(__DIR__ . '/action.settings_3022401.yml'));
  12. $connection->insert('config')
  13. ->fields([
  14. 'collection',
  15. 'name',
  16. 'data',
  17. ])
  18. ->values([
  19. 'collection' => '',
  20. 'name' => 'action.settings',
  21. 'data' => serialize($action_settings),
  22. ])
  23. ->execute();
  24. // Enable action module.
  25. $extensions = $connection->select('config')
  26. ->fields('config', ['data'])
  27. ->condition('name', 'core.extension')
  28. ->execute()
  29. ->fetchField();
  30. $extensions = unserialize($extensions);
  31. $connection->update('config')
  32. ->fields([
  33. 'data' => serialize(array_merge_recursive($extensions, ['module' => ['action' => 0]])),
  34. ])
  35. ->condition('name', 'core.extension')
  36. ->execute();