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