fixed handling of the 'owner' setting for ezmlm-idx > v5 (Closes: #24)

improved ezmlm-idx version detection (5.0 / 5.1 / 6.x)
This commit is contained in:
lars 2007-04-03 15:55:06 +00:00
parent 3b9e364756
commit 8dd9f5b755

View file

@ -724,7 +724,9 @@ sub check_version {
# 0 => unknown version # 0 => unknown version
# 3 => ezmlm v0.53 # 3 => ezmlm v0.53
# 4 => ezmlm-idx v0.4* # 4 => ezmlm-idx v0.4*
# 5 => ezmlm-idx v5.* # 5 => ezmlm-idx v5.0
# 5.1 => ezmlm-idx v5.1
# 6 => ezmlm-idx v6.*
sub get_version { sub get_version {
my ($ezmlm, $idx); my ($ezmlm, $idx);
my $version = `$EZMLM_BASE/ezmlm-make -V 2>&1`; my $version = `$EZMLM_BASE/ezmlm-make -V 2>&1`;
@ -733,14 +735,20 @@ sub get_version {
$ezmlm = $1 if ($version =~ m/ezmlm-([\d\.]+)$/); $ezmlm = $1 if ($version =~ m/ezmlm-([\d\.]+)$/);
$idx = $1 if ($version =~ m/ezmlm-idx-([\d\.]+)$/); $idx = $1 if ($version =~ m/ezmlm-idx-([\d\.]+)$/);
if(defined($ezmlm)) { if (defined($ezmlm)) {
return 3; return 3;
} elsif (defined($idx)) { } elsif (defined($idx)) {
if (($idx =~ m/^(\d)/) && ($1 >= 5)) { if (($idx =~ m/^(\d)/) && ($1 >= 6)) {
# version 5.0 or higher # version 6.0 or higher
return 6;
} elsif (($idx =~ m/^(\d)\.(\d)/) && ($1 >= 5) && ($2 == 1)) {
# version 5.1
return 5.1;
} elsif (($idx =~ m/^(\d)/) && ($1 >= 5)) {
# version 5.0
return 5; return 5;
} elsif (($idx =~ m/^0\.(\d)/) && ($1 >= 0)) { } elsif (($idx =~ m/^0\.(\d)/) && ($1 >= 0)) {
# version 0.4 or higher # version 0.4xx
return 4; return 4;
} else { } else {
return 0; return 0;
@ -822,22 +830,25 @@ sub _getconfig_idx5 {
# values from different files # values from different files
# first: preset a array with "filename" and "option_number" # first: preset a array with "filename" and "option_number"
%optionfiles = ( %optionfiles = (
'sublist', '0', 'sublist', 0,
'fromheader', '3', 'fromheader', 3,
'tstdigopts', '4', 'tstdigopts', 4,
'owner', '5', 'owner', 5,
'sql', '6', 'sql', 6,
'modpost', '7', 'modpost', 7,
'modsub', '8', 'modsub', 8,
'remote', '9'); 'remote', 9);
while (($file, $opt_num) = each(%optionfiles)) { while (($file, $opt_num) = each(%optionfiles)) {
if (-e "$self->{'LIST_NAME'}/$file") { if (-e "$self->{'LIST_NAME'}/$file") {
chomp($temp = $self->getpart($file)); chomp($temp = $self->getpart($file));
$temp =~ m/^(.*)$/m; # take only the first line $temp =~ m/^(.*)$/m; # take only the first line
$temp = $1; $temp = $1;
# the 'owner' setting can be ignored if it is a path (starts with '/')
unless (($opt_num == 5) && ($temp =~ m#^/#)) {
$options .= " -$opt_num '$temp'" if ($temp =~ /\S/); $options .= " -$opt_num '$temp'" if ($temp =~ /\S/);
} }
} }
}
return $options; return $options;
} }