drupal-8.rest-rest_update_8201.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_8201().
  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']['basic_auth'] = 0;
  26. $extensions['module']['rest'] = 0;
  27. $extensions['module']['serialization'] = 0;
  28. $connection->update('config')
  29. ->fields([
  30. 'data' => serialize($extensions),
  31. ])
  32. ->condition('collection', '')
  33. ->condition('name', 'core.extension')
  34. ->execute();
  35. // Install the rest configuration.
  36. $config = [
  37. 'resources' => [
  38. 'entity:node' => [
  39. 'GET' => [
  40. 'supported_formats' => ['json'],
  41. 'supported_auth' => ['basic_auth'],
  42. ],
  43. ],
  44. ],
  45. 'link_domain' => NULL,
  46. ];
  47. $data = $connection->insert('config')
  48. ->fields([
  49. 'name' => 'rest.settings',
  50. 'data' => serialize($config),
  51. 'collection' => ''
  52. ])
  53. ->execute();