Fix monitor not change status when zoneminder state change

pull/3454/head
Javier Gonzalez 2022-03-09 21:07:39 +01:00
parent e84b82df18
commit 3d093ed8a6
1 changed files with 10 additions and 14 deletions

View File

@ -118,12 +118,7 @@ if ( $command eq 'state' ) {
($Config{ZM_SERVER_ID} ? (ServerId=>$Config{ZM_SERVER_ID}) : () ), order=>'Id ASC') ($Config{ZM_SERVER_ID} ? (ServerId=>$Config{ZM_SERVER_ID}) : () ), order=>'Id ASC')
) { ) {
foreach my $definition ( @{$state->{Definitions}} ) { foreach my $definition ( @{$state->{Definitions}} ) {
# FIXME WHY a REGEXP
if ( $monitor->{Id} =~ /^$definition->{Id}$/ ) { if ( $monitor->{Id} =~ /^$definition->{Id}$/ ) {
$monitor->{NewFunction} = $definition->{Function};
$monitor->{NewEnabled} = $definition->{Enabled};
last;
}
if ( if (
($monitor->{Capturing} ne $definition->{Capturing}) ($monitor->{Capturing} ne $definition->{Capturing})
or or
@ -134,6 +129,7 @@ if ( $command eq 'state' ) {
$monitor->save({ map { $_ => $$definition{$_} } qw(Capturing Analysing Recording) }); $monitor->save({ map { $_ => $$definition{$_} } qw(Capturing Analysing Recording) });
last; # definition last; # definition
} # end if } # end if
} # end if
} # end foreach definition } # end foreach definition
} # end foreach monitor } # end foreach monitor