From 84c94efaa8ff2479aa18d3767c97d8f1fbe1a6c5 Mon Sep 17 00:00:00 2001 From: Isaac Date: Fri, 4 May 2018 02:26:25 +0200 Subject: [PATCH] Move redunddant close methods into parent. Use Fatal instead of croak. Croak is not defined so it causes an infinite loop --- scripts/ZoneMinder/lib/ZoneMinder/Control.pm | 14 +++++++------- scripts/ZoneMinder/lib/ZoneMinder/Control/3S.pm | 6 ------ .../ZoneMinder/lib/ZoneMinder/Control/AxisV2.pm | 6 ------ .../ZoneMinder/lib/ZoneMinder/Control/DCS3415.pm | 6 ------ .../lib/ZoneMinder/Control/FI8608W_Y2k.pm | 6 ------ .../lib/ZoneMinder/Control/FI8620_Y2k.pm | 6 ------ .../ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm | 6 ------ .../lib/ZoneMinder/Control/FI9821W_Y2k.pm | 6 ------ .../ZoneMinder/lib/ZoneMinder/Control/Floureon.pm | 6 ------ .../ZoneMinder/lib/ZoneMinder/Control/HikVision.pm | 1 + .../ZoneMinder/lib/ZoneMinder/Control/Keekoon.pm | 6 ------ .../lib/ZoneMinder/Control/LoftekSentinel.pm | 6 ------ scripts/ZoneMinder/lib/ZoneMinder/Control/M8640.pm | 5 ----- .../lib/ZoneMinder/Control/MaginonIPC.pm | 6 ------ .../ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm | 6 ------ .../ZoneMinder/lib/ZoneMinder/Control/Netcat.pm | 6 ------ .../lib/ZoneMinder/Control/PanasonicIP.pm | 6 ------ .../ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm | 3 +-- .../ZoneMinder/lib/ZoneMinder/Control/Reolink.pm | 6 ------ .../lib/ZoneMinder/Control/SPP1802SWPTZ.pm | 6 ------ .../lib/ZoneMinder/Control/SkyIPCam7xx.pm | 5 ----- .../ZoneMinder/lib/ZoneMinder/Control/TVIP862.pm | 6 ------ .../lib/ZoneMinder/Control/Toshiba_IK_WB11A.pm | 6 ------ .../ZoneMinder/lib/ZoneMinder/Control/Wanscam.pm | 6 ------ .../lib/ZoneMinder/Control/WanscamHW0025.pm | 6 ------ scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm | 6 ------ web/api/app/Plugin/Crud | 2 +- 27 files changed, 10 insertions(+), 146 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control.pm index a76ebe861..efd17abcd 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control.pm @@ -49,7 +49,7 @@ sub new { my $self = {}; $self->{name} = $class; if ( !defined($id) ) { - Fatal( "No monitor defined when invoking protocol ".$self->{name} ); + Fatal('No monitor defined when invoking protocol '.$self->{name}); } $self->{id} = $id; bless( $self, $class ); @@ -61,14 +61,13 @@ sub DESTROY { sub AUTOLOAD { my $self = shift; - my $class = ref($self) || croak( "$self not object" ); + my $class = ref($self) || Fatal("$self not object"); my $name = $AUTOLOAD; $name =~ s/.*://; - if ( exists($self->{$name}) ) - { - return( $self->{$name} ); + if ( exists($self->{$name}) ) { + return $self->{$name}; } - croak( "Can't access $name member of object of class $class" ); + Error("Can't access $name member of object of class $class"); } sub getKey { @@ -83,7 +82,8 @@ sub open { sub close { my $self = shift; - Error( "No close method defined for protocol ".$self->{name} ); + $self->{state} = 'closed'; + Debug('No close method defined for protocol '.$self->{name}); } sub loadMonitor { diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/3S.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/3S.pm index e33e51d13..31e99be26 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/3S.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/3S.pm @@ -63,12 +63,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/AxisV2.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/AxisV2.pm index 4afcecc58..d63236c86 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/AxisV2.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/AxisV2.pm @@ -57,12 +57,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/DCS3415.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/DCS3415.pm index 2db704320..03561c0fd 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/DCS3415.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/DCS3415.pm @@ -89,12 +89,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm index aad4e7246..87b7707a4 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm @@ -89,12 +89,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm index c3cfd8456..bb5146d42 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm @@ -95,12 +95,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm index 9cf00d077..5501d4e21 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm @@ -80,12 +80,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm index 7165fd686..921646438 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm @@ -94,12 +94,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $msg = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Floureon.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Floureon.pm index 27a18d065..521409e11 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Floureon.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Floureon.pm @@ -69,12 +69,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm index 04aaabb23..feca9db7d 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/HikVision.pm @@ -125,6 +125,7 @@ sub PutCmd { Warning("Control Device appears to be incorrect. Control Device should be set to \"$1\". Control Device currently set to \"$self->{Monitor}{ControlDevice}\"."); + $self->{Monitor}{ControlDevice} = $1; } } } diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Keekoon.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Keekoon.pm index 0cd7d2e73..28f95b7d3 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Keekoon.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Keekoon.pm @@ -99,12 +99,6 @@ sub open } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm index 3b8454b62..b0751c9af 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm @@ -67,12 +67,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/M8640.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/M8640.pm index cac9e62eb..dff4cb317 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/M8640.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/M8640.pm @@ -62,11 +62,6 @@ sub open { $self->{state} = 'open'; } -sub close { - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; my $msg = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/MaginonIPC.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/MaginonIPC.pm index 5bb7704a1..409c397c9 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/MaginonIPC.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/MaginonIPC.pm @@ -57,12 +57,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm index 556cb7810..1f74c3e26 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Ncs370.pm @@ -57,12 +57,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Netcat.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Netcat.pm index 4c23d80e1..e345e5eab 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Netcat.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Netcat.pm @@ -87,12 +87,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm index d36594e2d..55292d3e4 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/PanasonicIP.pm @@ -57,12 +57,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm index 0502c4a20..2dc2ac95b 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoD.pm @@ -66,8 +66,7 @@ sub open $self->{state} = 'open'; } -sub close -{ +sub close { my $self = shift; $self->{state} = 'closed'; $self->{port}->close(); diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Reolink.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Reolink.pm index ba0b291f4..370d463c3 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Reolink.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Reolink.pm @@ -112,12 +112,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/SPP1802SWPTZ.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/SPP1802SWPTZ.pm index 45f622265..fe89bf51e 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/SPP1802SWPTZ.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/SPP1802SWPTZ.pm @@ -76,12 +76,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm index 486e0390a..7175d1e84 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm @@ -57,11 +57,6 @@ sub open { $self->{state} = 'open'; } -sub close { - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; my $msg = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/TVIP862.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/TVIP862.pm index 4d794e554..827540dce 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/TVIP862.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/TVIP862.pm @@ -139,12 +139,6 @@ sub open } # end if ! $res->is_success } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Toshiba_IK_WB11A.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Toshiba_IK_WB11A.pm index 5c6c4aef1..410a6c79b 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Toshiba_IK_WB11A.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Toshiba_IK_WB11A.pm @@ -58,12 +58,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Wanscam.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Wanscam.pm index b78557b00..1e6e70410 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Wanscam.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Wanscam.pm @@ -83,12 +83,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/WanscamHW0025.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/WanscamHW0025.pm index 8ed5a47e3..036b051ed 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/WanscamHW0025.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/WanscamHW0025.pm @@ -65,12 +65,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm index 2e6910889..ea287a42f 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/onvif.pm @@ -62,12 +62,6 @@ sub open $self->{state} = 'open'; } -sub close -{ - my $self = shift; - $self->{state} = 'closed'; -} - sub printMsg { my $self = shift; diff --git a/web/api/app/Plugin/Crud b/web/api/app/Plugin/Crud index 0bd63fb46..c3976f147 160000 --- a/web/api/app/Plugin/Crud +++ b/web/api/app/Plugin/Crud @@ -1 +1 @@ -Subproject commit 0bd63fb464957080ead342db58ca9e01532cf1ef +Subproject commit c3976f1478c681b0bbc132ec3a3e82c3984eeed5