2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

fhem.pl: make setGlobalAttrBeforeFork more generic

git-svn-id: https://svn.fhem.de/fhem/trunk@19265 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-04-26 08:01:47 +00:00
parent a95ef13956
commit cbbaaa2708

View File

@ -2774,6 +2774,8 @@ GlobalAttr($$$$)
$cvsid =~ m/(fhem.pl) (\d+) (\d+-\d+-\d+)/; $cvsid =~ m/(fhem.pl) (\d+) (\d+-\d+-\d+)/;
$attr{global}{version} = "$1:$2/$3"; $attr{global}{version} = "$1:$2/$3";
my $counter = 0; my $counter = 0;
my $oldVal = $attr{global}{modpath};
$attr{global}{modpath} = $val;
if(configDBUsed()) { if(configDBUsed()) {
my $list = cfgDB_Read99(); # retrieve filelist from configDB my $list = cfgDB_Read99(); # retrieve filelist from configDB
@ -2796,6 +2798,7 @@ GlobalAttr($$$$)
closedir(DH); closedir(DH);
if(!$counter) { if(!$counter) {
$attr{global}{modpath} = $oldVal;
return "No modules found, set modpath to a directory in which a " . return "No modules found, set modpath to a directory in which a " .
"subdirectory called \"FHEM\" exists wich in turn contains " . "subdirectory called \"FHEM\" exists wich in turn contains " .
"the fhem module files <*>.pm"; "the fhem module files <*>.pm";
@ -4287,6 +4290,7 @@ ReplaceEventMap2($$$)
return @{$str}; return @{$str};
} }
# Needed for logfile/pid/nofork
sub sub
setGlobalAttrBeforeFork($) setGlobalAttrBeforeFork($)
{ {
@ -4303,15 +4307,7 @@ setGlobalAttrBeforeFork($)
foreach my $l (@rows) { foreach my $l (@rows) {
$l =~ s/[\r\n]//g; $l =~ s/[\r\n]//g;
next if($l !~ m/^attr\s+global\s+([^\s]+)\s+(.*)$/); next if($l !~ m/^attr\s+global\s+([^\s]+)\s+(.*)$/);
my ($n,$v) = ($1,$2); AnalyzeCommand(undef, $l);
$v =~ s/#.*//;
$v =~ s/ .*$//;
if($fhemdebug) {
$v = "-" if($n eq "logfile");
$v = 5 if($n eq "verbose");
}
$attr{global}{$n} = $v;
GlobalAttr("set", "global", $n, $v);
} }
} }