annotate core/modules/hal/hal.install @ 13:5fb285c0d0e3

Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've been lucky to get away with this so far, as we don't support self-registration which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5 was vulnerable to.
author Chris Cannam
date Mon, 23 Apr 2018 09:33:26 +0100
parents 4c8ae668cc8c
children 1fec387a4317
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /**
Chris@0 4 * @file
Chris@0 5 * Update functions for the HAL module.
Chris@0 6 */
Chris@0 7
Chris@0 8 /**
Chris@0 9 * Move 'link_domain' from 'rest.settings' to 'hal.settings'.
Chris@0 10 */
Chris@0 11 function hal_update_8301() {
Chris@0 12 $config_factory = \Drupal::configFactory();
Chris@0 13
Chris@0 14 // The default value for the 'link_domain' key is `~`, which is the YAML
Chris@0 15 // equivalent of PHP's `NULL`. If the REST module is not installed, this is
Chris@0 16 // the value we will store in 'hal.settings'.
Chris@0 17 $link_domain = NULL;
Chris@0 18
Chris@0 19 // But if the REST module was installed, we migrate its 'link_domain' setting,
Chris@0 20 // because we are actually moving that setting from 'rest.settings' to
Chris@0 21 // 'hal.settings'.
Chris@0 22 $rest_settings = $config_factory->getEditable('rest.settings');
Chris@0 23 if ($rest_settings->getRawData() !== []) {
Chris@0 24 $link_domain = $rest_settings->get('link_domain');
Chris@0 25 // Remove the 'link_domain' setting from 'rest.settings'.
Chris@0 26 $rest_settings->clear('link_domain')
Chris@0 27 ->save();
Chris@0 28 }
Chris@0 29
Chris@0 30 $hal_settings = $config_factory->getEditable('hal.settings');
Chris@0 31 $hal_settings->set('link_domain', $link_domain);
Chris@0 32 $hal_settings->save(TRUE);
Chris@0 33 }