You are here

function drd_agent_update_8001 in DRD Agent 4.0.x

#3195153: Migrate agent settings from config to state.

File

./drd_agent.install, line 21

Code

function drd_agent_update_8001(&$sandbox) {
  $config = \Drupal::service('config.factory')
    ->getEditable('drd_agent.settings');
  $ott = $config
    ->get('ott');
  $authorised = $config
    ->get('authorised') ?? [];
  $debug_mode = $config
    ->get('debug_mode');
  $state = \Drupal::state();
  $state
    ->set('drd_agent.ott', $ott);
  $state
    ->set('drd_agent.authorised', $authorised);
  $state
    ->set('drd_agent.debug_mode', $debug_mode);
  $config
    ->delete();
}