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

98_update.pm: add CRE (Create-Only) keyword (Forum #105721)

git-svn-id: https://svn.fhem.de/fhem/trunk@20585 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-11-25 16:37:13 +00:00
parent 9509c08674
commit f65941eeca

View File

@ -285,7 +285,7 @@ doUpdate($$$$)
my %lh;
foreach my $l (@locList) {
my @l = split(" ", $l, 4);
next if($l[0] ne "UPD");
next if($l[0] ne "UPD" && $l[0] ne "CRE");
$lh{$l[3]}{TS} = $l[1];
$lh{$l[3]}{LEN} = $l[2];
}
@ -322,7 +322,7 @@ doUpdate($$$$)
uLog 4, "mv $root/$r[1] $root/$r[2]". ($mvret ? " FAILED:$mvret":"");
}
next if($r[0] ne "UPD");
next if($r[0] ne "UPD" && $r[0] ne "CRE");
my $fName = $r[3];
my $wouldExcl;
foreach my $ex (@excl) {
@ -342,9 +342,10 @@ doUpdate($$$$)
my $isExcl = (!$isCheck && $wouldExcl);
my $fPath = "$root/$fName";
$fPath = $0 if($fPath =~ m/$mainPgm/);
my $fileOk = ($lh{$fName} &&
$lh{$fName}{TS} eq $r[1] &&
$lh{$fName}{LEN} eq $r[2]);
my $fileOk = ($lh{$fName} && # local files exists and
($r[0] eq "CRE") || # either file is create only
($lh{$fName}{TS} eq $r[1] && # or both TS and LEN is same
$lh{$fName}{LEN} eq $r[2])); # as the remote one
if($isExcl && !$fileOk) {
uLog 1, "update: skipping $fName, matches exclude_from_update";
$nSkipped++;