mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Add config option for file to add new directives to https://github.com/virtualmin/virtualmin-gpl/issues/398
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
dovecot=Dovecot server program,0
|
||||
dovecot_config=Full path to Dovecot configuration file,0
|
||||
add_config=Add new directives to file,3,Main configuration file
|
||||
init_script=Dovecot init script name,3,None exists
|
||||
pid_file=Dovecot server PID file,0
|
||||
|
||||
@@ -18,6 +18,17 @@ foreach my $f (split(/\s+/, $config{'dovecot_config'})) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
# get_add_config_file()
|
||||
# Returns the full path to the first valid config file for new top-level
|
||||
# directives
|
||||
sub get_add_config_file
|
||||
{
|
||||
foreach my $f (split(/\s+/, $config{'add_config'})) {
|
||||
return $f if (-r $f);
|
||||
}
|
||||
return &get_config_file();
|
||||
}
|
||||
|
||||
# get_config()
|
||||
# Returns a list of dovecot config entries
|
||||
sub get_config
|
||||
@@ -280,12 +291,13 @@ elsif (!$dir && defined($value)) {
|
||||
}
|
||||
else {
|
||||
# Need to put at end of main config
|
||||
local $lref = &read_file_lines(&get_config_file());
|
||||
local $file = &get_add_config_file();
|
||||
local $lref = &read_file_lines($file);
|
||||
push(@$lref, $newline);
|
||||
push(@$conf, { 'name' => $name,
|
||||
'value' => $value,
|
||||
'enabled' => 1,
|
||||
'file' => &get_config_file(),
|
||||
'file' => $file,
|
||||
'line' => scalar(@$lref)-1,
|
||||
'eline' => scalar(@$lref)-1,
|
||||
'sectionname' => $sname,
|
||||
|
||||
Reference in New Issue
Block a user