From 6ab1c3ced8559e6a2d1ba71fbedb2cabdc1da90b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 25 Jul 2018 09:39:08 -0400 Subject: [PATCH 1/7] proper case table header --- web/skins/classic/views/options.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/options.php b/web/skins/classic/views/options.php index 31c1f57cb..2a17cf0b9 100644 --- a/web/skins/classic/views/options.php +++ b/web/skins/classic/views/options.php @@ -260,8 +260,8 @@ foreach( array_map( 'basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI - - + + From 00bdfdcb16e0dd723bdfb1c1e3524cb193582b2c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 25 Jul 2018 09:39:24 -0400 Subject: [PATCH 2/7] increase height of function popup so that dropdown options fit in it --- web/skins/classic/js/base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/js/base.js b/web/skins/classic/js/base.js index 71289b6d2..9eb93ee77 100644 --- a/web/skins/classic/js/base.js +++ b/web/skins/classic/js/base.js @@ -41,7 +41,7 @@ var popupSizes = { 'filter': { 'width': 900, 'height': 700 }, 'frame': { 'addWidth': 32, 'minWidth': 384, 'addHeight': 200 }, 'frames': { 'width': 600, 'height': 600 }, - 'function': { 'width': 350, 'height': 160 }, + 'function': { 'width': 350, 'height': 260 }, 'group': { 'width': 760, 'height': 600 }, 'groups': { 'width': 540, 'height': 420 }, 'image': { 'addWidth': 48, 'addHeight': 80 }, From 2ff47e04da8f9c475e3d450cb5ea92945459f886 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 25 Jul 2018 17:04:42 -0400 Subject: [PATCH 3/7] the updated video-js.css puts the fonts into a font dir. --- web/skins/classic/js/{ => font}/vjs.eot | Bin web/skins/classic/js/{ => font}/vjs.ttf | Bin web/skins/classic/js/{ => font}/vjs.woff | Bin 3 files changed, 0 insertions(+), 0 deletions(-) rename web/skins/classic/js/{ => font}/vjs.eot (100%) rename web/skins/classic/js/{ => font}/vjs.ttf (100%) rename web/skins/classic/js/{ => font}/vjs.woff (100%) diff --git a/web/skins/classic/js/vjs.eot b/web/skins/classic/js/font/vjs.eot similarity index 100% rename from web/skins/classic/js/vjs.eot rename to web/skins/classic/js/font/vjs.eot diff --git a/web/skins/classic/js/vjs.ttf b/web/skins/classic/js/font/vjs.ttf similarity index 100% rename from web/skins/classic/js/vjs.ttf rename to web/skins/classic/js/font/vjs.ttf diff --git a/web/skins/classic/js/vjs.woff b/web/skins/classic/js/font/vjs.woff similarity index 100% rename from web/skins/classic/js/vjs.woff rename to web/skins/classic/js/font/vjs.woff From 48b91c5544fdbdc6adc61691a023a3e145613efb Mon Sep 17 00:00:00 2001 From: Roman Dissertori Date: Sat, 28 Jul 2018 15:26:02 +0200 Subject: [PATCH 4/7] Bugfix in Control and added new Camera (#2171) * fixed control typos missing word "s" for "Controls" Table for database queries * added Dericam P2 camera Control * fixed missing CanReset column * Update DericamP2.pm * added some more missing controls CanSleep, CanWake * Update DericamP2.pm * Update DericamP2.pm * Update DericamP2.pm * Update DericamP2.pm * Update DericamP2.pm * Update DericamP2.pm * Update DericamP2.pm * Update zm_create.sql.in --- db/zm_create.sql.in | 1 + .../lib/ZoneMinder/Control/DericamP2.pm | 475 ++++++++++++++++++ web/includes/Control.php | 5 +- 3 files changed, 480 insertions(+), 1 deletion(-) create mode 100644 scripts/ZoneMinder/lib/ZoneMinder/Control/DericamP2.pm diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index cf7c1150d..a6284bc79 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -778,6 +778,7 @@ INSERT INTO `Controls` VALUES (NULL,'Reolink RLC-411','Ffmpeg','Reolink',0,0,1,1 INSERT INTO `Controls` VALUES (NULL,'Reolink RLC-420','Ffmpeg','Reolink',0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); INSERT INTO `Controls` VALUES (NULL,'D-LINK DCS-3415','Remote','DCS3415',0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); INSERT INTO `Controls` VALUES (NULL,'IOS Camera','Ffmpeg','IPCAMIOS',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO `Controls` VALUES (NULL,'Dericam P2','Ffmpeg','DericamP2',0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,10,0,1,1,1,0,0,0,1,1,0,0,0,0,1,1,45,0,0,1,0,0,0,0,1,1,45,0,0,0,0); -- -- Add some monitor preset values -- diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/DericamP2.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/DericamP2.pm new file mode 100644 index 000000000..90221c770 --- /dev/null +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/DericamP2.pm @@ -0,0 +1,475 @@ +# ========================================================================== +# +# ZoneMinder Dericam P2 Control Protocol Module +# Copyright (C) Roman Dissertori +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# ========================================================================== +# +# This module contains the implementation of the Dericam P2 device control protocol +# +package ZoneMinder::Control::DericamP2; + +use 5.006; +use strict; +use warnings; + +require ZoneMinder::Control; + +our @ISA = qw(ZoneMinder::Control); + +our %CamParams = (); + +# ========================================================================== +# +# Dericam P2 Control Protocol +# +# On ControlAddress use the format : +# USERNAME:PASSWORD@ADDRESS:PORT +# eg : admin:@10.1.2.1:80 +# zoneminder:zonepass@10.0.100.1:40000 +# +# ========================================================================== + +use ZoneMinder::Logger qw(:all); +use ZoneMinder::Config qw(:all); + +use Time::HiRes qw( usleep ); + +sub open +{ + my $self = shift; + + $self->loadMonitor(); + + use LWP::UserAgent; + $self->{ua} = LWP::UserAgent->new; + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); + + $self->{state} = 'open'; +} + +sub printMsg +{ + my $self = shift; + my $msg = shift; + my $msg_len = length($msg); + + Debug( $msg."[".$msg_len."]" ); +} + +sub sendCmd +{ + my $self = shift; + my $cmd = shift; + my $result = undef; + printMsg( $cmd, "Tx" ); + + my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" ); + Info( "http://".$self->{Monitor}->{ControlAddress}."/$cmd".$self->{Monitor}->{ControlDevice} ); + my $res = $self->{ua}->request($req); + + if ( $res->is_success ) + { + $result = !undef; + } + else + { + Error( "Error check failed:'".$res->status_line()."'" ); + } + + return( $result ); +} + +sub getCamParams +{ + my $self = shift; + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=getimageattr"; + + my $req = $self->sendCmd( $cmd ); + my $res = $self->{ua}->request($req); + + if ( $res->is_success ) + { + # Parse results setting values in %FCParams + my $content = $res->decoded_content; + + while ($content =~ s/var\s+([^=]+)=([^;]+);//ms) { + $CamParams{$1} = $2; + } + } + else + { + Error( "Error check failed:'".$res->status_line()."'" ); + } +} + +#autoStop +#This makes use of the ZoneMinder Auto Stop Timeout on the Control Tab +sub autoStop +{ + my $self = shift; + my $stop_command = shift; + my $autostop = shift; + if( $stop_command && $autostop) + { + Debug( "Auto Stop" ); + usleep( $autostop ); + my $cmd = "decoder_control.cgi?command=".$stop_command; + $self->sendCmd( $cmd ); + } + +} + +# Reset the Camera +sub reset +{ + my $self = shift; + Debug( "Camera Reset" ); + # Move to default position + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-act=home"; + $self->sendCmd( $cmd ); + + # Reset all other values to default + $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-image_type=1&-default=on"; + $self->sendCmd( $cmd ); +} + +# Reboot Camera (on Sleep button) +sub sleep +{ + my $self = shift; + Debug( "Camera Reboot" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-act=sysreboot"; + $self->sendCmd( $cmd ); +} + +# Stop the Camera +sub moveStop +{ + my $self = shift; + Debug( "Camera Stop" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-act=stop"; + $self->sendCmd( $cmd ); +} + +#Up Arrow +sub moveConUp +{ + my $self = shift; + my $stop_command = "1"; + Debug( "Move Up" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=up&-speed=45"; + $self->sendCmd( $cmd ); + #$self->autoStop( $stop_command, $self->{Monitor}->{AutoStopTimeout} ); +} + +#Down Arrow +sub moveConDown +{ + my $self = shift; + my $stop_command = "3"; + Debug( "Move Down" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=down&-speed=45"; + $self->sendCmd( $cmd ); + #$self->autoStop( $stop_command, $self->{Monitor}->{AutoStopTimeout} ); +} + +#Left Arrow +sub moveConLeft +{ + my $self = shift; + my $stop_command = "5"; + Debug( "Move Left" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=left&-speed=45"; + $self->sendCmd( $cmd ); + #$self->autoStop( $stop_command, $self->{Monitor}->{AutoStopTimeout} ); +} + +#Right Arrow +sub moveConRight +{ + my $self = shift; + my $stop_command = "7"; + Debug( "Move Right" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=right&-speed=45"; + $self->sendCmd( $cmd ); + #$self->autoStop( $stop_command, $self->{Monitor}->{AutoStopTimeout} ); +} + +#Zoom In +sub zoomConTele +{ + my $self = shift; + Debug( "Zoom Tele" ); + my $cmd = "decoder_control.cgi?command=18"; + $self->sendCmd( $cmd ); +} + +#Zoom Out +sub zoomConWide +{ + my $self = shift; + Debug( "Zoom Wide" ); + my $cmd = "decoder_control.cgi?command=16"; + $self->sendCmd( $cmd ); +} + +#Diagonally Up Right Arrow +#This camera does not have builtin diagonal commands so we emulate them +sub moveConUpRight +{ + my $self = shift; + Debug( "Move Diagonally Up Right" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=upright&-speed=45"; + $self->sendCmd( $cmd ); +} + +#Diagonally Down Right Arrow +#This camera does not have builtin diagonal commands so we emulate them +sub moveConDownRight +{ + my $self = shift; + Debug( "Move Diagonally Down Right" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=downright&-speed=45"; + $self->sendCmd( $cmd ); +} + +#Diagonally Up Left Arrow +#This camera does not have builtin diagonal commands so we emulate them +sub moveConUpLeft +{ + my $self = shift; + Debug( "Move Diagonally Up Left" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=upleft&-speed=45"; + $self->sendCmd( $cmd ); +} + +#Diagonally Down Left Arrow +#This camera does not have builtin diagonal commands so we emulate them +sub moveConDownLeft +{ + my $self = shift; + Debug( "Move Diagonally Down Left" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=downnleft&-speed=45"; + $self->sendCmd( $cmd ); +} + +#Set Camera Preset +#Presets must be translated into values internal to the camera +#Those values are: 30,32,34,36,38,40,42,44 for presets 1-8 respectively +sub presetSet +{ + my $self = shift; + my $params = shift; + my $preset = $self->getParam( $params, 'preset' ); + Debug( "Set Preset $preset" ); + + if (( $preset >= 1 ) && ( $preset <= 8 )) { + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=preset&-act=set&-number=".(($preset*2) + 28); + $self->sendCmd( $cmd ); + } +} + +#Recall Camera Preset +#Presets must be translated into values internal to the camera +#Those values are: 31,33,35,37,39,41,43,45 for presets 1-8 respectively +sub presetGoto +{ + my $self = shift; + my $params = shift; + my $preset = $self->getParam( $params, 'preset' ); + Debug( "Goto Preset $preset" ); + + if (( $preset >= 1 ) && ( $preset <= 8 )) { + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-number=".(($preset*2) + 29); + $self->sendCmd( $cmd ); + } + + if ( $preset == 9 ) { + $self->horizontalPatrol(); + } + + if ( $preset == 10 ) { + $self->verticalPatrol(); + } +} + +#Horizontal Patrol +sub horizontalPatrol +{ + my $self = shift; + Debug( "Horizontal Patrol" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=hscan"; + $self->sendCmd( $cmd ); +} + +#Vertical Patrol +sub verticalPatrol +{ + my $self = shift; + Debug( "Vertical Patrol" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=vscan"; + $self->sendCmd( $cmd ); +} + +# Increase Brightness +sub irisAbsOpen +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'brightness'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'brightness'} += $step; + $CamParams{'brightness'} = 100 if ($CamParams{'brightness'} > 100); + Debug( "Increase Brightness" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-brightness=".$CamParams{'brightness'}; + $self->sendCmd( $cmd ); +} + +# Decrease Brightness +sub irisAbsClose +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'brightness'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'brightness'} -= $step; + $CamParams{'brightness'} = 0 if ($CamParams{'brightness'} < 0); + Debug( "Decrease Brightness" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-brightness=".$CamParams{'brightness'}; + $self->sendCmd( $cmd ); +} + +# Increase Contrast +sub whiteAbsIn +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'contrast'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'contrast'} += $step; + $CamParams{'contrast'} = 100 if ($CamParams{'contrast'} > 100); + Debug( "Increase Contrast" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-contrast=".$CamParams{'contrast'}; + $self->sendCmd( $cmd ); +} + +# Decrease Contrast +sub whiteAbsOut +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'contrast'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'contrast'} -= $step; + $CamParams{'contrast'} = 0 if ($CamParams{'contrast'} < 0); + Debug( "Decrease Contrast" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-contrast=".$CamParams{'contrast'}; + $self->sendCmd( $cmd ); +} + +#TODO Saturation cgi-bin/hi3510/param.cgi?cmd=setimageattr&-saturation=44 [0-255] +sub satIncrease +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'saturation'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'saturation'} += $step; + $CamParams{'saturation'} = 255 if ($CamParams{'saturation'} > 255); + Debug( "Increase Saturation" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-saturation=".$CamParams{'saturation'}; + $self->sendCmd( $cmd ); +} + +sub satDecrease +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'saturation'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'saturation'} -= $step; + $CamParams{'saturation'} = 0 if ($CamParams{'saturation'} < 0); + Debug( "Decrease Saturation" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-saturation=".$CamParams{'saturation'}; + $self->sendCmd( $cmd ); +} +#TODO Sharpness cgi-bin/hi3510/param.cgi?cmd=setimageattr&-sharpness=37 [0-100] +sub sharpIncrease +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'sharpness'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'sharpness'} += $step; + $CamParams{'sharpness'} = 100 if ($CamParams{'sharpness'} > 100); + Debug( "Increase Sharpness" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-sharpness=".$CamParams{'sharpness'}; + $self->sendCmd( $cmd ); +} + +sub sharpDecrease +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'sharpness'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'sharpness'} -= $step; + $CamParams{'sharpness'} = 0 if ($CamParams{'sharpness'} < 0); + Debug( "Decrease Sharpness" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-sharpness=".$CamParams{'sharpness'}; + $self->sendCmd( $cmd ); +} + +#TODO Hue cgi-bin/hi3510/param.cgi?cmd=setimageattr&-hue=37 [0-100] +sub hueIncrease +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'hue'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'hue'} += $step; + $CamParams{'hue'} = 100 if ($CamParams{'hue'} > 100); + Debug( "Increase Hue" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-hue=".$CamParams{'hue'}; + $self->sendCmd( $cmd ); +} + +sub hueDecrease +{ + my $self = shift; + my $params = shift; + $self->getCamParams() unless($CamParams{'hue'}); + my $step = $self->getParam( $params, 'step' ); + + $CamParams{'hue'} -= $step; + $CamParams{'hue'} = 0 if ($CamParams{'hue'} < 0); + Debug( "Decrease Hue" ); + my $cmd = "cgi-bin/hi3510/param.cgi?cmd=setimageattr&-hue=".$CamParams{'hue'}; + $self->sendCmd( $cmd ); +} + +1; diff --git a/web/includes/Control.php b/web/includes/Control.php index de5f221ff..74beeca05 100644 --- a/web/includes/Control.php +++ b/web/includes/Control.php @@ -12,6 +12,9 @@ private $defaults = array( 'CanMoveRel' => 0, 'CanMoveCon' => 0, 'CanPan' => 0, + 'CanReset' => 0, + 'CanSleep' => 0, + 'CanWake' => 0, 'MinPanRange' => NULL, 'MaxPanRange' => NULL, 'MinPanStep' => NULL, @@ -103,7 +106,7 @@ private $defaults = array( if ( $IdOrRow ) { $row = NULL; if ( is_integer( $IdOrRow ) or is_numeric( $IdOrRow ) ) { - $row = dbFetchOne( 'SELECT * FROM Control WHERE Id=?', NULL, array( $IdOrRow ) ); + $row = dbFetchOne( 'SELECT * FROM Controls WHERE Id=?', NULL, array( $IdOrRow ) ); if ( ! $row ) { Error("Unable to load Control record for Id=" . $IdOrRow ); } From 363e1dda973cc8515d9a6e918e378d4ba58e62f2 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 31 Jul 2018 10:15:26 -0400 Subject: [PATCH 5/7] Add some more Monitor defaults, mainly Refresh which gets called in watch.js.php --- web/includes/Monitor.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/includes/Monitor.php b/web/includes/Monitor.php index 8fc69a9cd..efa530c0a 100644 --- a/web/includes/Monitor.php +++ b/web/includes/Monitor.php @@ -9,17 +9,19 @@ private $defaults = array( 'Name' => '', 'StorageId' => 0, 'ServerId' => 0, + 'Type' => 'Ffmpeg', 'Function' => 'None', 'Enabled' => 1, + 'LinkedMonitors' => null, 'Width' => null, 'Height' => null, 'Orientation' => null, 'AnalysisFPSLimit' => null, 'ZoneCount' => 0, 'Triggers' => null, - 'Type' => 'Ffmpeg', 'MaxFPS' => null, 'AlarmMaxFPS' => null, + 'Refresh' => null, ); private $status_fields = array( 'AnalysisFPS' => null, From ee97dc39dc37b6c996d63a8e4a05e561d1af034a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 31 Jul 2018 10:22:13 -0400 Subject: [PATCH 6/7] Add Refresh column to Monitors table. Explicitly put it after ZoneCount in the update.sql --- db/zm_create.sql.in | 1 + db/zm_update-1.31.43.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index a6284bc79..966fa9023 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -517,6 +517,7 @@ CREATE TABLE `Monitors` ( `ArchivedEvents` int(10) default NULL, `ArchivedEventDiskSpace` bigint default NULL, `ZoneCount` TINYINT NOT NULL DEFAULT 0, + `Refresh` int(10) unsigned default NULL, PRIMARY KEY (`Id`) ) ENGINE=@ZM_MYSQL_ENGINE@; diff --git a/db/zm_update-1.31.43.sql b/db/zm_update-1.31.43.sql index d8d6eaefd..05a92288e 100644 --- a/db/zm_update-1.31.43.sql +++ b/db/zm_update-1.31.43.sql @@ -16,7 +16,7 @@ SET @s = (SELECT IF( AND column_name = 'Refresh' ) > 0, "SELECT 'Column Refresh exists in Monitors'", -"ALTER TABLE Monitors ADD `Refresh` int(10) unsigned default NULL" +"ALTER TABLE Monitors ADD `Refresh` int(10) unsigned default NULL AFTER `ZoneCount`" )); PREPARE stmt FROM @s; From 11cedb43351776ed17434ad808d23e6145f7030c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 31 Jul 2018 10:27:34 -0400 Subject: [PATCH 7/7] repeat the update that adds Refresh to Monitors. Bump version. --- db/zm_update-1.31.45.sql | 23 +++++++++++++++++++++++ version | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 db/zm_update-1.31.45.sql diff --git a/db/zm_update-1.31.45.sql b/db/zm_update-1.31.45.sql new file mode 100644 index 000000000..c3be6c4cd --- /dev/null +++ b/db/zm_update-1.31.45.sql @@ -0,0 +1,23 @@ +-- +-- This updates a 1.31.44 database to 1.31.45 +-- +-- Add WebSite enum to Monitor.Type +-- Add Refresh column to Monitors table + +-- This is the same as the update to 1.31.43, but due to Refresh not being added to zm_create.sql.in we need to have it +-- again in order to fix people who did a fresh install from 1.31.43 or 1.31.44. +-- + +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Monitors' + AND table_schema = DATABASE() + AND column_name = 'Refresh' + ) > 0, +"SELECT 'Column Refresh exists in Monitors'", +"ALTER TABLE Monitors ADD `Refresh` int(10) unsigned default NULL AFTER `ZoneCount`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; diff --git a/version b/version index 856307b22..6701dcb1c 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.31.44 +1.31.45