From fed7a191bfab332777ed2398b61c922469967838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Tue, 12 Nov 2024 08:58:59 +0200 Subject: [PATCH 1/2] UHF-8678: Install the HDBT cookie banner module to core-instances. --- helfi_platform_config.install | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/helfi_platform_config.install b/helfi_platform_config.install index cbcc2e3e3..de8d43726 100644 --- a/helfi_platform_config.install +++ b/helfi_platform_config.install @@ -202,3 +202,41 @@ function helfi_platform_config_update_9313() : void { $module_installer->install(['helfi_paragraphs_curated_event_list']); } } +/** + * UHF-8650: Install HDBT Cookie banner module. + * + * This update will also uninstall EU Cookie compliance and + * Helfi EU Cookie compliance modules. + */ +function helfi_platform_config_update_9314(): void { + /** @var \Drupal\helfi_api_base\Environment\EnvironmentResolver $environmentResolver */ + $environmentResolver = \Drupal::getContainer()->get('helfi_api_base.environment_resolver'); + + // Handle only Helfi core sites. + try { + $environmentResolver->getActiveEnvironment(); + } + catch (\InvalidArgumentException) { + return; + } + + $module_handler = \Drupal::moduleHandler(); + $module_installer = \Drupal::service('module_installer'); + + // Install the HDBT cookie banner module. + if (!$module_handler->moduleExists('hdbt_cookie_banner')) { + $module_installer->install(['hdbt_cookie_banner']); + } + + // Uninstall the EU Cookie compliance and Helfi EU Cookie compliance + // modules if they are installed. + if ( + $module_handler->moduleExists('eu_cookie_compliance') || + $module_handler->moduleExists('helfi_eu_cookie_compliance') + ) { + $module_installer->uninstall([ + 'eu_cookie_compliance', + 'helfi_eu_cookie_compliance', + ]); + } +} From ed134b66ebc72acd7fa3d9d6c66ff8f353ac9329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Wed, 20 Nov 2024 13:00:59 +0200 Subject: [PATCH 2/2] UHF-8678: Moved the HDBT cookie banner module installation to helfi_platform_config_base.install. --- helfi_platform_config.install | 38 ------------------ .../helfi_platform_config_base.install | 39 +++++++++++++++++++ 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/helfi_platform_config.install b/helfi_platform_config.install index de8d43726..cbcc2e3e3 100644 --- a/helfi_platform_config.install +++ b/helfi_platform_config.install @@ -202,41 +202,3 @@ function helfi_platform_config_update_9313() : void { $module_installer->install(['helfi_paragraphs_curated_event_list']); } } -/** - * UHF-8650: Install HDBT Cookie banner module. - * - * This update will also uninstall EU Cookie compliance and - * Helfi EU Cookie compliance modules. - */ -function helfi_platform_config_update_9314(): void { - /** @var \Drupal\helfi_api_base\Environment\EnvironmentResolver $environmentResolver */ - $environmentResolver = \Drupal::getContainer()->get('helfi_api_base.environment_resolver'); - - // Handle only Helfi core sites. - try { - $environmentResolver->getActiveEnvironment(); - } - catch (\InvalidArgumentException) { - return; - } - - $module_handler = \Drupal::moduleHandler(); - $module_installer = \Drupal::service('module_installer'); - - // Install the HDBT cookie banner module. - if (!$module_handler->moduleExists('hdbt_cookie_banner')) { - $module_installer->install(['hdbt_cookie_banner']); - } - - // Uninstall the EU Cookie compliance and Helfi EU Cookie compliance - // modules if they are installed. - if ( - $module_handler->moduleExists('eu_cookie_compliance') || - $module_handler->moduleExists('helfi_eu_cookie_compliance') - ) { - $module_installer->uninstall([ - 'eu_cookie_compliance', - 'helfi_eu_cookie_compliance', - ]); - } -} diff --git a/modules/helfi_platform_config_base/helfi_platform_config_base.install b/modules/helfi_platform_config_base/helfi_platform_config_base.install index 964135942..123784bd0 100644 --- a/modules/helfi_platform_config_base/helfi_platform_config_base.install +++ b/modules/helfi_platform_config_base/helfi_platform_config_base.install @@ -164,3 +164,42 @@ function helfi_platform_config_base_update_9005() : void { ->update($module); } } + +/** + * UHF-8650: Install HDBT Cookie banner module. + * + * This update will also uninstall EU Cookie compliance and + * Helfi EU Cookie compliance modules. + */ +function helfi_platform_config_base_update_9006(): void { + /** @var \Drupal\helfi_api_base\Environment\EnvironmentResolver $environmentResolver */ + $environmentResolver = \Drupal::getContainer()->get('helfi_api_base.environment_resolver'); + + // Handle only Helfi core sites. + try { + $environmentResolver->getActiveProject(); + } + catch (\InvalidArgumentException) { + return; + } + + $module_handler = \Drupal::moduleHandler(); + $module_installer = \Drupal::service('module_installer'); + + // Install the HDBT cookie banner module. + if (!$module_handler->moduleExists('hdbt_cookie_banner')) { + $module_installer->install(['hdbt_cookie_banner']); + } + + // Uninstall the EU Cookie compliance and Helfi EU Cookie compliance + // modules if they are installed. + if ( + $module_handler->moduleExists('eu_cookie_compliance') || + $module_handler->moduleExists('helfi_eu_cookie_compliance') + ) { + $module_installer->uninstall([ + 'eu_cookie_compliance', + 'helfi_eu_cookie_compliance', + ]); + } +}