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,21 +118,17 @@ 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}; if (
$monitor->{NewEnabled} = $definition->{Enabled}; ($monitor->{Capturing} ne $definition->{Capturing})
last; or
} ($monitor->{Analysing} ne $definition->{Analysing})
if ( or
($monitor->{Capturing} ne $definition->{Capturing}) ($monitor->{Recording} ne $definition->{Recording})
or ) {
($monitor->{Analysing} ne $definition->{Analysing}) $monitor->save({ map { $_ => $$definition{$_} } qw(Capturing Analysing Recording) });
or last; # definition
($monitor->{Recording} ne $definition->{Recording}) } # end if
) {
$monitor->save({ map { $_ => $$definition{$_} } qw(Capturing Analysing Recording) });
last; # definition
} # end if } # end if
} # end foreach definition } # end foreach definition
} # end foreach monitor } # end foreach monitor