diff --git a/drd_agent.install b/drd_agent.install index 367b292db7dde6ffb724fbdb45287c67039d7c27..1294e1c808a779648bd4cb23db8262e422e9f87d 100644 --- a/drd_agent.install +++ b/drd_agent.install @@ -34,3 +34,24 @@ function drd_agent_update_8001(mixed &$sandbox): void { $config->delete(); } + +/** + * Update stored crypt methods after 4.1.3 update. + */ +function drd_agent_update_8002(): void { + $state = \Drupal::state(); + $authorized = $state->get('drd_agent.authorised'); + + // Check if old state values exists. + if ($authorized !== NULL) { + foreach ($authorized as $uuid => $settings) { + match($settings['crypt']) { + 'OpenSSL' => $authorized[$uuid]['crypt'] = 'OpenSsl', + 'TLS' => $authorized[$uuid]['crypt'] = 'Tls', + default => NULL, + }; + } + + $state->set('drd_agent.authorised', $authorized); + } +}