Skip to content

Commit 4406a09

Browse files
committed
missing check for a few rspamd custom templates
1 parent 99e2f0a commit 4406a09

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

install/lib/installer_base.lib.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,7 +1868,11 @@ public function configure_rspamd() {
18681868
);
18691869
foreach ($local_d as $f) {
18701870
$tpl = new tpl();
1871-
$tpl->newTemplate("rspamd_${f}.master");
1871+
if (file_exists($conf['ispconfig_install_dir']."/server/conf-custom/install/rspamd_${f}.master")) {
1872+
$tpl->newTemplate($conf['ispconfig_install_dir']."/server/conf-custom/install/rspamd_${f}.master");
1873+
} else {
1874+
$tpl->newTemplate("rspamd_${f}.master");
1875+
}
18721876

18731877
$tpl->setVar('dkim_path', $mail_config['dkim_path']);
18741878
$tpl->setVar('rspamd_redis_servers', $mail_config['rspamd_redis_servers']);
@@ -1964,7 +1968,11 @@ public function configure_rspamd() {
19641968
unset($server_ini_string);
19651969

19661970
$tpl = new tpl();
1967-
$tpl->newTemplate('rspamd_worker-controller.inc.master');
1971+
if (file_exists($conf['ispconfig_install_dir']."/server/conf-custom/install/rspamd_worker-controller.inc.master")) {
1972+
$tpl->newTemplate($conf['ispconfig_install_dir']."/server/conf-custom/install/rspamd_worker-controller.inc.master");
1973+
} else {
1974+
$tpl->newTemplate("rspamd_worker-controller.inc.master");
1975+
}
19681976
$rspamd_password = $mail_config['rspamd_password'];
19691977
$crypted_password = trim(exec('rspamadm pw -p ' . escapeshellarg($rspamd_password)));
19701978
if($crypted_password) {

server/plugins-available/rspamd_plugin.inc.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,11 @@ function user_settings_update($event_name, $data, $internal = false) {
295295
$app->load('tpl');
296296

297297
$tpl = new tpl();
298-
$tpl->newTemplate('rspamd_users.inc.conf.master');
298+
if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master")) {
299+
$tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master");
300+
} else {
301+
$tpl->newTemplate("rspamd_users.inc.conf.master");
302+
}
299303

300304
$tpl->setVar('record_identifier', 'ispc_' . $type . '_' . $entry_id);
301305
$tpl->setVar('priority', $settings_priority);
@@ -443,7 +447,12 @@ function spamfilter_wblist_update($event_name, $data) {
443447
}
444448
} else {
445449
$tpl = new tpl();
446-
$tpl->newTemplate('rspamd_wblist.inc.conf.master');
450+
if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_wblist.inc.conf.master")) {
451+
$tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_wblist.inc.conf.master");
452+
} else {
453+
$tpl->newTemplate("rspamd_wblist.inc.conf.master");
454+
}
455+
447456
$tpl->setVar('list_scope', ($global_filter ? 'global' : 'spamfilter'));
448457
$tpl->setVar('record_id', $record_id);
449458
// add 30/40 to priority to avoid collisions and prefer white/blacklists above mailbox/domain spamfilter settings
@@ -521,7 +530,11 @@ function server_update($event_name, $data) {
521530
);
522531
foreach ($local_d as $f) {
523532
$tpl = new tpl();
524-
$tpl->newTemplate("rspamd_${f}.master");
533+
if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_${f}.master")) {
534+
$tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_${f}.master");
535+
} else {
536+
$tpl->newTemplate("rspamd_${f}.master");
537+
}
525538

526539
$tpl->setVar('dkim_path', $mail_config['dkim_path']);
527540
$tpl->setVar('rspamd_redis_servers', $mail_config['rspamd_redis_servers']);

0 commit comments

Comments
 (0)