Verified Commit f9ba7fe6 authored by Helmo's avatar Helmo
Browse files

Fix undefined $postfix_version and generalize code, #6405

parent 20a04da2
......@@ -1071,6 +1071,14 @@ class installer_base {
return true;
}
public function get_postfix_version() {
//* Get postfix version
exec('postconf -d mail_version 2>&1', $out);
$postfix_version = preg_replace('/.*=\s*/', '', $out[0]);
unset($out);
return $postfix_version;
}
public function configure_postfix($options = '') {
global $conf,$autoinstall;
$cf = $conf['postfix'];
......@@ -1080,10 +1088,7 @@ class installer_base {
$this->error("The postfix configuration directory '$config_dir' does not exist.");
}
//* Get postfix version
exec('postconf -d mail_version 2>&1', $out);
$postfix_version = preg_replace('/.*=\s*/', '', $out[0]);
unset($out);
$postfix_version = $this->get_postfix_version();
//* Install virtual mappings
foreach (glob('tpl/mysql-virtual_*.master') as $filename) {
......@@ -1482,8 +1487,7 @@ class installer_base {
$config_dir = $conf['postfix']['config_dir'];
$quoted_config_dir = preg_quote($config_dir, '|');
$postfix_version = `postconf -d mail_version 2>/dev/null`;
$postfix_version = preg_replace( '/mail_version\s*=\s*(.*)\s*/', '$1', $postfix_version );
$postfix_version = $this->get_postfix_version();
//* Configure master.cf and add a line for deliver
if(!$this->get_postfix_service('dovecot', 'unix')) {
......@@ -1725,6 +1729,7 @@ class installer_base {
break;
}
}
$postfix_version = $this->get_postfix_version();
# postfix < 3.3 needs this when using reject_unverified_recipient:
if(version_compare($postfix_version, 3.3, '<')) {
$postconf_commands[] = "enable_original_recipient = yes";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment