From b6a6b6e34e222fadd3c632089f61e191a631db8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Fauske?= <jorn@ramsalt.com> Date: Sat, 15 Mar 2025 12:43:41 +0100 Subject: [PATCH 1/4] Issue #3512611 Update crypt method names stored in state. After updating to 4.1.3, crypt method names stored in state do not match the classes renamed in 4.1.3. This make the code in Drupal\drd_agent\Crypt\Base::getInstance() fail with "Class not found". This changeset update the crypt method name stored in state. --- drd_agent.install | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drd_agent.install b/drd_agent.install index 367b292..5b1871b 100644 --- a/drd_agent.install +++ b/drd_agent.install @@ -34,3 +34,23 @@ function drd_agent_update_8001(mixed &$sandbox): void { $config->delete(); } + +/** + * Update stored crypt methods after 4.1.3 update + */ +function drd_agent_update_8002() { + $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', + }; + } + + $state->set('drd_agent.authorised', $authorized); + } +} -- GitLab From 14d35685e2a81ab1efb0c123d7fec09c943f60fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Fauske?= <jorn@ramsalt.com> Date: Sat, 15 Mar 2025 13:17:58 +0100 Subject: [PATCH 2/4] Issue #3512611 Fix phpstand and phpcs reported issues --- drd_agent.install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drd_agent.install b/drd_agent.install index 5b1871b..e014169 100644 --- a/drd_agent.install +++ b/drd_agent.install @@ -36,9 +36,9 @@ function drd_agent_update_8001(mixed &$sandbox): void { } /** - * Update stored crypt methods after 4.1.3 update + * Update stored crypt methods after 4.1.3 update. */ -function drd_agent_update_8002() { +function drd_agent_update_8002(): void { $state = \Drupal::state(); $authorized = $state->get('drd_agent.authorised'); -- GitLab From 9771ed8510913ba2f1dc7b4977d1a3b6603a9b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Fauske?= <jorn@ramsalt.com> Date: Sat, 15 Mar 2025 13:34:28 +0100 Subject: [PATCH 3/4] Issue #3512611 Add missing default in match() statement --- drd_agent.install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drd_agent.install b/drd_agent.install index e014169..097c27b 100644 --- a/drd_agent.install +++ b/drd_agent.install @@ -43,11 +43,12 @@ function drd_agent_update_8002(): void { $authorized = $state->get('drd_agent.authorised'); // Check if old state values exists. - if ($authorized !== NULL) { + if ($authorized !== null) { foreach ($authorized as $uuid => $settings) { match($settings['crypt']) { 'OpenSSL' => $authorized[$uuid]['crypt'] = 'OpenSsl', 'TLS' => $authorized[$uuid]['crypt'] = 'Tls', + default => null, }; } -- GitLab From cda9d13d30c7d453baaa896067ceef64401ba25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Fauske?= <jorn@ramsalt.com> Date: Sat, 15 Mar 2025 13:39:57 +0100 Subject: [PATCH 4/4] Issue #3512611 null => NULL to keep phpcs happy. --- drd_agent.install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drd_agent.install b/drd_agent.install index 097c27b..1294e1c 100644 --- a/drd_agent.install +++ b/drd_agent.install @@ -43,12 +43,12 @@ function drd_agent_update_8002(): void { $authorized = $state->get('drd_agent.authorised'); // Check if old state values exists. - if ($authorized !== null) { + if ($authorized !== NULL) { foreach ($authorized as $uuid => $settings) { match($settings['crypt']) { 'OpenSSL' => $authorized[$uuid]['crypt'] = 'OpenSsl', 'TLS' => $authorized[$uuid]['crypt'] = 'Tls', - default => null, + default => NULL, }; } -- GitLab