Skip to content

Commit 7361c65

Browse files
author
Till Brehm
committed
Merge branch '6405-postfix_version' into 'develop'
Fix undefined $postfix_version and generalize code, #6405 Closes #6405 See merge request ispconfig/ispconfig3!1654
2 parents 0939b14 + f9ba7fe commit 7361c65

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

install/lib/installer_base.lib.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,14 @@ public function remove_postfix_service( $service, $type ) {
10731073
return true;
10741074
}
10751075

1076+
public function get_postfix_version() {
1077+
//* Get postfix version
1078+
exec('postconf -d mail_version 2>&1', $out);
1079+
$postfix_version = preg_replace('/.*=\s*/', '', $out[0]);
1080+
unset($out);
1081+
return $postfix_version;
1082+
}
1083+
10761084
public function configure_postfix($options = '') {
10771085
global $conf,$autoinstall;
10781086
$cf = $conf['postfix'];
@@ -1082,10 +1090,7 @@ public function configure_postfix($options = '') {
10821090
$this->error("The postfix configuration directory '$config_dir' does not exist.");
10831091
}
10841092

1085-
//* Get postfix version
1086-
exec('postconf -d mail_version 2>&1', $out);
1087-
$postfix_version = preg_replace('/.*=\s*/', '', $out[0]);
1088-
unset($out);
1093+
$postfix_version = $this->get_postfix_version();
10891094

10901095
//* Install virtual mappings
10911096
foreach (glob('tpl/mysql-virtual_*.master') as $filename) {
@@ -1484,8 +1489,7 @@ public function configure_dovecot() {
14841489

14851490
$config_dir = $conf['postfix']['config_dir'];
14861491
$quoted_config_dir = preg_quote($config_dir, '|');
1487-
$postfix_version = `postconf -d mail_version 2>/dev/null`;
1488-
$postfix_version = preg_replace( '/mail_version\s*=\s*(.*)\s*/', '$1', $postfix_version );
1492+
$postfix_version = $this->get_postfix_version();
14891493

14901494
//* Configure master.cf and add a line for deliver
14911495
if(!$this->get_postfix_service('dovecot', 'unix')) {
@@ -1727,6 +1731,7 @@ public function configure_amavis() {
17271731
break;
17281732
}
17291733
}
1734+
$postfix_version = $this->get_postfix_version();
17301735
# postfix < 3.3 needs this when using reject_unverified_recipient:
17311736
if(version_compare($postfix_version, 3.3, '<')) {
17321737
$postconf_commands[] = "enable_original_recipient = yes";

0 commit comments

Comments
 (0)