Backup of db before drupal security update
[yaffs-website] / web / core / modules / serialization / serialization.install
1 <?php
2
3 /**
4  * @file
5  * Update functions for the Serialization module.
6  */
7
8 /**
9  * Implements hook_requirements().
10  */
11 function serialization_requirements($phase) {
12   $requirements = [];
13
14   if ($phase == 'runtime') {
15     $requirements['serialization_as_strings'] = [
16       'title' => t('Serialized data types'),
17       'severity' => REQUIREMENT_INFO,
18     ];
19
20     if (\Drupal::config('serialization.settings')->get('bc_primitives_as_strings')) {
21       $requirements['serialization_as_strings']['value'] = t('Enabled');
22       $requirements['serialization_as_strings']['description'] = t('The Serialization API is configured to output only string values for REST and other applications (instead of integers or Booleans when appropriate). <a href="https://www.drupal.org/node/2837696">Disabling this backwards compatibility mode</a> is recommended unless your sites or applications require string output.');
23     }
24     else {
25       $requirements['serialization_as_strings']['value'] = t('Not enabled');
26       $requirements['serialization_as_strings']['description'] = t('The Serialization API is configured with the recommended default and outputs typed values (integers, Booleans, or strings as appropriate) for REST and other applications. If your site or applications require string output, you can <a href="https://www.drupal.org/node/2837696">enable backwards compatibility mode</a>.');
27     }
28   }
29
30   return $requirements;
31 }
32
33 /**
34  * @see hal_update_8301()
35  */
36 function serialization_update_8301() {}
37
38 /**
39  * Add serialization.settings::bc_primitives_as_strings configuration.
40  */
41 function serialization_update_8302() {
42   $config_factory = \Drupal::configFactory();
43   $config_factory->getEditable('serialization.settings')
44     ->set('bc_primitives_as_strings', FALSE)
45     ->save(TRUE);
46
47   return t('The REST API will no longer output all values as strings. Integers/booleans will be used where appropriate. If your site depends on these value being strings, <a href="https://www.drupal.org/node/2837696">read the change record to learn how to enable the BC mode.</a>');
48 }