drupal-8.rest-rest_update_8203.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @file
  4. * Contains database additions to drupal-8.bare.standard.php.gz for testing the
  5. * upgrade path of rest_update_8203().
  6. */
  7. use Drupal\Core\Database\Database;
  8. $connection = Database::getConnection();
  9. // Set the schema version.
  10. $connection->insert('key_value')
  11. ->fields([
  12. 'collection' => 'system.schema',
  13. 'name' => 'rest',
  14. 'value' => 'i:8000;',
  15. ])
  16. ->execute();
  17. // Update core.extension.
  18. $extensions = $connection->select('config')
  19. ->fields('config', ['data'])
  20. ->condition('collection', '')
  21. ->condition('name', 'core.extension')
  22. ->execute()
  23. ->fetchField();
  24. $extensions = unserialize($extensions);
  25. $extensions['module']['rest'] = 0;
  26. $extensions['module']['serialization'] = 0;
  27. $connection->update('config')
  28. ->fields([
  29. 'data' => serialize($extensions),
  30. ])
  31. ->condition('collection', '')
  32. ->condition('name', 'core.extension')
  33. ->execute();
  34. // Install the rest configuration.
  35. $config = [
  36. 'resources' => [
  37. 'entity:node' => [
  38. 'GET' => [
  39. 'supported_formats' => ['json'],
  40. 'supported_auth' => ['basic_auth'],
  41. ],
  42. ],
  43. ],
  44. 'link_domain' => NULL,
  45. ];
  46. $data = $connection->insert('config')
  47. ->fields([
  48. 'name' => 'rest.settings',
  49. 'data' => serialize($config),
  50. 'collection' => ''
  51. ])
  52. ->execute();