diff --git a/db/zm_update-1.28.107.sql b/db/zm_update-1.28.107.sql index 4d4c6432d..76fea0100 100644 --- a/db/zm_update-1.28.107.sql +++ b/db/zm_update-1.28.107.sql @@ -13,7 +13,7 @@ SET @s = (SELECT IF( AND table_schema = DATABASE() AND column_name = 'Id' ) > 0, -"SELECT 'Column ID already exists in Monitors'", +"SELECT 'Column ID already exists in Frames'", "ALTER TABLE `Frames` ADD COLUMN `Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT FIRST, DROP PRIMARY KEY, ADD PRIMARY KEY(`Id`)" )); diff --git a/db/zm_update-1.28.109.sql b/db/zm_update-1.28.109.sql new file mode 100644 index 000000000..c23927e26 --- /dev/null +++ b/db/zm_update-1.28.109.sql @@ -0,0 +1,21 @@ +-- +-- This updates a 1.28.106 database to 1.28.107 +-- + +-- +-- Update Frame table to have a PrimaryKey of ID, insetad of a Composite Primary Key +-- Used primarially for compatibility with CakePHP +-- +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Servers' + AND table_schema = DATABASE() + AND column_name = 'Hostname' + ) > 0, +"SELECT 'Column Hostname already exists in Servers'", +"ALTER TABLE `Servers` ADD COLUMN `Hostname` TEXT AFTER Name", +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; diff --git a/distros/debian/zoneminder.postinst b/distros/debian/zoneminder.postinst index d06f9c641..42a3bb1dc 100644 --- a/distros/debian/zoneminder.postinst +++ b/distros/debian/zoneminder.postinst @@ -15,7 +15,7 @@ if [ "$1" = "configure" ]; then # test if database if already present... if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf - echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql + echo 'grant lock tables, alter,select,insert,update,delete,create,index on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql fi invoke-rc.d zoneminder stop || true @@ -47,6 +47,8 @@ if [ "$1" = "configure" ]; then chown www-data:www-data -R /var/cache/zoneminder else chown www-data:www-data /var/log/zm + + echo 'grant lock tables, create, index, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql zmupdate.pl fi fi diff --git a/distros/ubuntu1504_cmake/zoneminder.postinst b/distros/ubuntu1504_cmake/zoneminder.postinst index e7810e468..4d2da7331 100644 --- a/distros/ubuntu1504_cmake/zoneminder.postinst +++ b/distros/ubuntu1504_cmake/zoneminder.postinst @@ -8,6 +8,17 @@ if [ "$1" = "configure" ]; then if [ -z "$2" ]; then chown www-data:www-data -R /var/cache/zoneminder fi + + # Do this every time the package is installed or upgraded + # Test for database presence to avoid failure of zmupdate.pl + + # Ensure zoneminder is stopped + deb-systemd-invoke stop zoneminder.service || exit $? + + echo 'grant lock tables, create, index, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql + # Run the ZoneMinder update tool + zmupdate.pl --nointeractive + fi #DEBHELPER# diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 92fddf98d..5eacd8203 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -57,7 +57,7 @@ EXTRA_DIST = \ ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm \ ZoneMinder/lib/ZoneMinder/ConfigData.pm.in \ ZoneMinder/lib/ZoneMinder/Control.pm \ - ZoneMinder/lib/ZoneMinder/Control \ # Grab all ptz control skips under the Control folder + ZoneMinder/lib/ZoneMinder/Control \ ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm \ ZoneMinder/lib/ZoneMinder/Trigger/Channel/Handle.pm \ ZoneMinder/lib/ZoneMinder/Trigger/Channel/Spawning.pm \ diff --git a/src/zm_remote_camera_rtsp.cpp b/src/zm_remote_camera_rtsp.cpp index 7e00a5d60..a07d97a8e 100644 --- a/src/zm_remote_camera_rtsp.cpp +++ b/src/zm_remote_camera_rtsp.cpp @@ -30,8 +30,9 @@ RemoteCameraRtsp::RemoteCameraRtsp( int p_id, const std::string &p_method, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, bool p_rtsp_describe, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : RemoteCamera( p_id, "rtsp", p_host, p_port, p_path, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture ), - rtspThread( 0 ), - rtsp_describe( p_rtsp_describe ) + rtsp_describe( p_rtsp_describe ), + rtspThread( 0 ) + { if ( p_method == "rtpUni" ) method = RtspThread::RTP_UNICAST; diff --git a/src/zm_rtsp.h b/src/zm_rtsp.h index b23536e20..92b675324 100644 --- a/src/zm_rtsp.h +++ b/src/zm_rtsp.h @@ -49,12 +49,13 @@ private: private: int mId; - bool mRtspDescribe; + RtspMethod mMethod; std::string mProtocol; std::string mHost; std::string mPort; std::string mPath; + bool mRtspDescribe; std::string mUrl; // Reworked authentication system diff --git a/web/includes/database.php b/web/includes/database.php index b849405d9..2d7bfd7a9 100644 --- a/web/includes/database.php +++ b/web/includes/database.php @@ -32,6 +32,7 @@ function dbConnect() try { $dbConn = new PDO( ZM_DB_TYPE . ':host=' . ZM_DB_HOST . ';dbname='.ZM_DB_NAME, ZM_DB_USER, ZM_DB_PASS ); + $dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $ex ) { echo "Unable to connect to ZM db." . $ex->getMessage(); $dbConn = null; @@ -111,7 +112,7 @@ function dbQuery( $sql, $params=NULL ) { $result = $dbConn->query( $sql ); } } catch(PDOException $e) { - Fatal( "SQL-ERR '".$e.getMessage()."', statement was '".$sql."'" ); + Fatal( "SQL-ERR '".$e->getMessage()."', statement was '".$sql."'" ); } return( $result ); }