From 4406a09a2e0f9f64612eedf07fa3cd141cafc9f7 Mon Sep 17 00:00:00 2001 From: Jesse Norell Date: Tue, 20 Apr 2021 13:25:17 -0600 Subject: [PATCH] missing check for a few rspamd custom templates --- install/lib/installer_base.lib.php | 12 ++++++++++-- .../plugins-available/rspamd_plugin.inc.php | 19 ++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index aa85837ffc..622674267c 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -1868,7 +1868,11 @@ class installer_base { ); foreach ($local_d as $f) { $tpl = new tpl(); - $tpl->newTemplate("rspamd_${f}.master"); + if (file_exists($conf['ispconfig_install_dir']."/server/conf-custom/install/rspamd_${f}.master")) { + $tpl->newTemplate($conf['ispconfig_install_dir']."/server/conf-custom/install/rspamd_${f}.master"); + } else { + $tpl->newTemplate("rspamd_${f}.master"); + } $tpl->setVar('dkim_path', $mail_config['dkim_path']); $tpl->setVar('rspamd_redis_servers', $mail_config['rspamd_redis_servers']); @@ -1964,7 +1968,11 @@ class installer_base { unset($server_ini_string); $tpl = new tpl(); - $tpl->newTemplate('rspamd_worker-controller.inc.master'); + if (file_exists($conf['ispconfig_install_dir']."/server/conf-custom/install/rspamd_worker-controller.inc.master")) { + $tpl->newTemplate($conf['ispconfig_install_dir']."/server/conf-custom/install/rspamd_worker-controller.inc.master"); + } else { + $tpl->newTemplate("rspamd_worker-controller.inc.master"); + } $rspamd_password = $mail_config['rspamd_password']; $crypted_password = trim(exec('rspamadm pw -p ' . escapeshellarg($rspamd_password))); if($crypted_password) { diff --git a/server/plugins-available/rspamd_plugin.inc.php b/server/plugins-available/rspamd_plugin.inc.php index 63640d02e6..9d34ac8a36 100644 --- a/server/plugins-available/rspamd_plugin.inc.php +++ b/server/plugins-available/rspamd_plugin.inc.php @@ -295,7 +295,11 @@ class rspamd_plugin { $app->load('tpl'); $tpl = new tpl(); - $tpl->newTemplate('rspamd_users.inc.conf.master'); + if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master")) { + $tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master"); + } else { + $tpl->newTemplate("rspamd_users.inc.conf.master"); + } $tpl->setVar('record_identifier', 'ispc_' . $type . '_' . $entry_id); $tpl->setVar('priority', $settings_priority); @@ -443,7 +447,12 @@ class rspamd_plugin { } } else { $tpl = new tpl(); - $tpl->newTemplate('rspamd_wblist.inc.conf.master'); + if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_wblist.inc.conf.master")) { + $tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_wblist.inc.conf.master"); + } else { + $tpl->newTemplate("rspamd_wblist.inc.conf.master"); + } + $tpl->setVar('list_scope', ($global_filter ? 'global' : 'spamfilter')); $tpl->setVar('record_id', $record_id); // add 30/40 to priority to avoid collisions and prefer white/blacklists above mailbox/domain spamfilter settings @@ -521,7 +530,11 @@ class rspamd_plugin { ); foreach ($local_d as $f) { $tpl = new tpl(); - $tpl->newTemplate("rspamd_${f}.master"); + if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_${f}.master")) { + $tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_${f}.master"); + } else { + $tpl->newTemplate("rspamd_${f}.master"); + } $tpl->setVar('dkim_path', $mail_config['dkim_path']); $tpl->setVar('rspamd_redis_servers', $mail_config['rspamd_redis_servers']); -- GitLab