mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 20:17:45 +00:00
92_FileLog.pm: add cross-file-border patch (Forum #41791)
git-svn-id: https://svn.fhem.de/fhem/trunk@9815 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c63c9984a2
commit
1c69000c74
@ -574,10 +574,38 @@ FileLog_Get($@)
|
|||||||
if($from =~ m/^(....)-(..)-(..)/) {
|
if($from =~ m/^(....)-(..)-(..)/) {
|
||||||
$linf = $hash->{logfile};
|
$linf = $hash->{logfile};
|
||||||
my ($Y,$m,$d) = ($1,$2,$3);
|
my ($Y,$m,$d) = ($1,$2,$3);
|
||||||
$linf =~ s/%Y/$Y/g;
|
sub expandFileWildcards($$$$) {
|
||||||
$linf =~ s/%m/$m/g;
|
my $f=shift;
|
||||||
$linf =~ s/%d/$d/g;
|
my ($Y,$m,$d)=@_;
|
||||||
$linf =~ s/%L/$attr{global}{logdir}/g if($attr{global}{logdir});
|
$f =~ s/%Y/$Y/g;
|
||||||
|
$f =~ s/%m/$m/g;
|
||||||
|
$f =~ s/%d/$d/g;
|
||||||
|
$f =~ s/%L/$attr{global}{logdir}/g if($attr{global}{logdir});
|
||||||
|
return($f);
|
||||||
|
};
|
||||||
|
$linf=expandFileWildcards($linf,$Y,$m,$d);
|
||||||
|
if($to =~ m/^(....)-(..)-(..)/) {
|
||||||
|
my $linf_to = $hash->{logfile};
|
||||||
|
my ($Y,$m,$d) = ($1,$2,$3);
|
||||||
|
$linf_to=expandFileWildcards($linf_to,$Y,$m,$d);
|
||||||
|
if(!($linf_to =~ m/%/)){
|
||||||
|
if($linf ne $linf_to){ # use to log files
|
||||||
|
my $tempread=$linf_to.".transit.temp.log";
|
||||||
|
if(open(my $temp,'>',$tempread)){
|
||||||
|
if(open(my $i,'<',$linf)){
|
||||||
|
print $temp join("",<$i>);
|
||||||
|
close($i);
|
||||||
|
}
|
||||||
|
if(open(my $i,'<',$linf_to)){
|
||||||
|
print $temp join("",<$i>);
|
||||||
|
close($i);
|
||||||
|
}
|
||||||
|
$linf=$tempread;
|
||||||
|
close($temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$linf = $hash->{currentlogfile} if($linf =~ m/%/ || ! -f $linf);
|
$linf = $hash->{currentlogfile} if($linf =~ m/%/ || ! -f $linf);
|
||||||
} else {
|
} else {
|
||||||
$linf = $hash->{currentlogfile};
|
$linf = $hash->{currentlogfile};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user