From d85390e08b9104266312d4a2330d296357d51fe5 Mon Sep 17 00:00:00 2001 From: Laurent Jouanneau Date: Thu, 31 Aug 2023 17:30:19 +0200 Subject: [PATCH] [internal] support of new config parameter notificationReceiverEmail for jCommunity --- .../lizmap/classes/lizmapServices.class.php | 8 ++++-- .../lizmap/install/upgrade_commconfig.php | 26 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 lizmap/modules/lizmap/install/upgrade_commconfig.php diff --git a/lizmap/modules/lizmap/classes/lizmapServices.class.php b/lizmap/modules/lizmap/classes/lizmapServices.class.php index 4b157a0426..2c22bd1950 100644 --- a/lizmap/modules/lizmap/classes/lizmapServices.class.php +++ b/lizmap/modules/lizmap/classes/lizmapServices.class.php @@ -437,8 +437,12 @@ public function saveIntoIni($ini, $liveIni) $liveIni->setValue($key, $this->{$prop}, $section); } elseif ($this->{$prop} != '') { $ini->setValue($prop, $this->{$prop}, 'services'); - if ($prop == 'adminContactEmail' && $this->globalConfig->lizmap['setAdminContactEmailAsReplyTo']) { - $liveIni->setValue('replyTo', $this->{$prop}, 'mailer'); + if ($prop == 'adminContactEmail') { + if ($this->globalConfig->lizmap['setAdminContactEmailAsReplyTo']) { + $liveIni->setValue('replyTo', $this->{$prop}, 'mailer'); + } + // for jCommunity 1.4+ + $liveIni->setValue('notificationReceiverEmail', $this->{$prop}, 'jcommunity'); } } else { $ini->removeValue($prop, 'services'); diff --git a/lizmap/modules/lizmap/install/upgrade_commconfig.php b/lizmap/modules/lizmap/install/upgrade_commconfig.php new file mode 100644 index 0000000000..01c98bf1dd --- /dev/null +++ b/lizmap/modules/lizmap/install/upgrade_commconfig.php @@ -0,0 +1,26 @@ +getValue('notificationReceiverEmail', 'jcommunity'); + if (!$currentValue) { + $lizmapConfFile = jApp::varConfigPath('lizmapConfig.ini.php'); + $ini = new \Jelix\IniFile\IniModifier($lizmapConfFile); + $contact = $ini->getValue('adminContactEmail', 'services'); + $liveIni->setValue('notificationReceiverEmail', $contact, 'jcommunity'); + $liveIni->save(); + } + } +}