Skip to content

Commit

Permalink
[internal] support of new config parameter notificationReceiverEmail …
Browse files Browse the repository at this point in the history
…for jCommunity
  • Loading branch information
laurentj authored and github-actions[bot] committed Aug 31, 2023
1 parent 825cb0a commit 6b38151
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lizmap/modules/lizmap/classes/lizmapServices.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,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');
Expand Down
26 changes: 26 additions & 0 deletions lizmap/modules/lizmap/install/upgrade_commconfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

class lizmapModuleUpgrader_commconfig extends jInstallerModule
{
public $targetVersions = array(
'3.7.0-alpha.3',
'3.6.6',
);

public $date = '2023-08-31';

public function install()
{
// copy the value of adminContactEmail into the config parameter notificationReceiverEmail
// for jCommunity 1.4+
$liveIni = new \Jelix\IniFile\IniModifier(jApp::varConfigPath('liveconfig.ini.php'));
$currentValue = $liveIni->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();
}
}
}

0 comments on commit 6b38151

Please sign in to comment.