From 48fa0c3d420f5cf4414578ae8a275be61631a6a1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 16 Jul 2015 13:04:28 -0400 Subject: [PATCH 1/6] add some utility db functions --- src/zm_db.cpp | 35 +++++++++++++++++++++++++++++++++++ src/zm_db.h | 3 +++ 2 files changed, 38 insertions(+) diff --git a/src/zm_db.cpp b/src/zm_db.cpp index 4ebc2f11f..0065488f5 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -75,3 +75,38 @@ void zmDbClose() zmDbConnected = false; } } + +MYSQL_RES * zmDbFetch( const char * query ) { + if ( ! zmDbConnected ) { + Error( "Not connected." ); + return NULL; + } + + if ( mysql_query( &dbconn, query ) ) { + Error( "Can't run query: %s", mysql_error( &dbconn ) ); + return NULL; + } + Debug( 4, "Success running query: %s", query ); + MYSQL_RES *result = mysql_store_result( &dbconn ); + if ( !result ) { + Error( "Can't use query result: %s for query %s", mysql_error( &dbconn ), query ); + return NULL; + } + return result; +} // end MYSQL_RES * zmDbFetch( const char * query ); + +MYSQL_ROW zmDBFetchOne( const char *query ) { + MYSQL_RES *result = zmDbFetch( query ); + int n_rows = mysql_num_rows( result ); + if ( n_rows != 1 ) { + Error( "Bogus number of lines return from query, %d returned for query %s.", n_rows, query ); + return NULL; + } + + MYSQL_ROW dbrow = mysql_fetch_row( result ); + if ( ! dbrow ) { + Error("Error getting row from query %s. Error is %s", query, mysql_error( &dbconn ) ); + return NULL; + } + return dbrow; +} diff --git a/src/zm_db.h b/src/zm_db.h index 07fd188a2..de1a81340 100644 --- a/src/zm_db.h +++ b/src/zm_db.h @@ -32,6 +32,9 @@ extern int zmDbConnected; void zmDbConnect(); void zmDbClose(); +MYSQL_RES * zmDbFetch( const char *query ); +MYSQL_ROW zmDBFetchOne( const char *query ); + #ifdef __cplusplus } /* extern "C" */ #endif From ad239699822f2bffea7aa481d1f7e660e0a3df98 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 16 Jul 2015 13:06:15 -0400 Subject: [PATCH 2/6] add space instead of + to handle old Axis cameras --- scripts/zmtrigger.pl.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/zmtrigger.pl.in b/scripts/zmtrigger.pl.in index e43b00bbb..5ffa308cf 100644 --- a/scripts/zmtrigger.pl.in +++ b/scripts/zmtrigger.pl.in @@ -446,7 +446,7 @@ sub handleMessage Debug( "Added timed event '$action_text', expires at $action_time (+$delay secs)\n" ); } } - elsif ( $action =~ /^(on|off)(?:\+(\d+))?$/ ) + elsif ( $action =~ /^(on|off)(?:[ \+](\d+))?$/ ) { next if ( !$monitor->{Enabled} ); From eb5bb641d6df4ecc47f9994830c444bfce0202db Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 16 Jul 2015 12:15:24 -0500 Subject: [PATCH 3/6] rpm packaging - require php-gd --- distros/fedora/zoneminder.f20.spec | 2 +- distros/fedora/zoneminder.f21.spec | 2 +- distros/redhat/zoneminder.el6.spec | 2 +- distros/redhat/zoneminder.el7.spec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/distros/fedora/zoneminder.f20.spec b/distros/fedora/zoneminder.f20.spec index b4e5ab9d3..b06db673d 100644 --- a/distros/fedora/zoneminder.f20.spec +++ b/distros/fedora/zoneminder.f20.spec @@ -38,7 +38,7 @@ BuildRequires: gcc gcc-c++ vlc-devel libcurl-devel libv4l-devel BuildRequires: httpd polkit-devel %{!?_without_ffmpeg:BuildRequires: ffmpeg} -Requires: httpd php php-mysql cambozola polkit net-tools psmisc +Requires: httpd php php-gd php-mysql cambozola polkit net-tools psmisc Requires: libjpeg-turbo vlc-core libcurl Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip) diff --git a/distros/fedora/zoneminder.f21.spec b/distros/fedora/zoneminder.f21.spec index e0424b80e..c1875cf5a 100644 --- a/distros/fedora/zoneminder.f21.spec +++ b/distros/fedora/zoneminder.f21.spec @@ -38,7 +38,7 @@ BuildRequires: gcc gcc-c++ vlc-devel libcurl-devel libv4l-devel BuildRequires: httpd polkit-devel %{!?_without_ffmpeg:BuildRequires: ffmpeg} -Requires: httpd php php-mysql cambozola polkit net-tools psmisc +Requires: httpd php php-gd php-mysql cambozola polkit net-tools psmisc Requires: libjpeg-turbo vlc-core libcurl Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip) diff --git a/distros/redhat/zoneminder.el6.spec b/distros/redhat/zoneminder.el6.spec index e50db96e7..3a65a80db 100644 --- a/distros/redhat/zoneminder.el6.spec +++ b/distros/redhat/zoneminder.el6.spec @@ -30,7 +30,7 @@ BuildRequires: libcurl-devel vlc-devel ffmpeg-devel polkit-devel # cmake needs the following installed at build time due to the way it auto-detects certain parameters BuildRequires: httpd ffmpeg -Requires: httpd php php-mysql mysql-server libjpeg-turbo polkit net-tools psmisc +Requires: httpd php php-gd php-mysql mysql-server libjpeg-turbo polkit net-tools psmisc Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip) Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP) diff --git a/distros/redhat/zoneminder.el7.spec b/distros/redhat/zoneminder.el7.spec index 78cd64d21..1d53cbdd5 100644 --- a/distros/redhat/zoneminder.el7.spec +++ b/distros/redhat/zoneminder.el7.spec @@ -32,7 +32,7 @@ BuildRequires: ffmpeg ffmpeg-devel perl(X10::ActiveHome) perl(Astro::SunTime) # cmake needs the following installed at build time due to the way it auto-detects certain parameters BuildRequires: httpd polkit-devel -Requires: httpd php php-mysql mariadb-server polkit net-tools psmisc +Requires: httpd php php-gd php-mysql mariadb-server polkit net-tools psmisc Requires: libjpeg-turbo vlc-core libcurl Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip) From e3042c59a577716075282b20be2765a4db04423b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 16 Jul 2015 13:40:16 -0400 Subject: [PATCH 4/6] add php-gd to list of dependencies for debian and ubuntu builds --- distros/debian/control | 2 +- distros/debian8/control | 2 +- distros/debian_cmake/control | 2 +- distros/ubuntu1204/control | 2 +- distros/ubuntu1504/control | 2 +- distros/ubuntu1504_cmake_split_packages/control | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/distros/debian/control b/distros/debian/control index 285c2257c..69b7c7bed 100644 --- a/distros/debian/control +++ b/distros/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.4 Package: zoneminder Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53 | libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53 | libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl, php-gd Recommends: mysql-server|mariadb-server Description: Video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security diff --git a/distros/debian8/control b/distros/debian8/control index efa9ecef2..47613b6a5 100644 --- a/distros/debian8/control +++ b/distros/debian8/control @@ -86,7 +86,7 @@ Section: web Architecture: any Depends: zoneminder-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, debconf, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, - php5, php5-mysql | php5-mysqlnd + php5, php5-mysql | php5-mysqlnd, php-gd Description: Essential files for ZoneMinder's web user interface ZoneMinder is a video camera security and surveillance solution. . diff --git a/distros/debian_cmake/control b/distros/debian_cmake/control index 01adf14df..92d25e897 100644 --- a/distros/debian_cmake/control +++ b/distros/debian_cmake/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.4 Package: zoneminder Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2 | httpd, libapache2-mod-php5 | libapache2-mod-fcgid | php5-fpm, php5-mysqlnd | php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client | mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0 +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2 | httpd, libapache2-mod-php5 | libapache2-mod-fcgid | php5-fpm, php5-mysqlnd | php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client | mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, php-gd Recommends: mysql-server | mariadb-server Description: Video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security diff --git a/distros/ubuntu1204/control b/distros/ubuntu1204/control index b1be82b34..599aef4d0 100644 --- a/distros/ubuntu1204/control +++ b/distros/ubuntu1204/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.4 Package: zoneminder Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client|mysql-client-5.6, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, libavdevice53 | libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client|mysql-client-5.6, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, libavdevice53 | libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl, php-gd Recommends: mysql-server|mariadb-server Description: Video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security diff --git a/distros/ubuntu1504/control b/distros/ubuntu1504/control index 5b63046c3..8922489e5 100644 --- a/distros/ubuntu1504/control +++ b/distros/ubuntu1504/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.4 Package: zoneminder Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client|mysql-client-5.6, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, libavdevice-ffmpeg56, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client|mysql-client-5.6, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, libavdevice-ffmpeg56, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl, php-gd Recommends: mysql-server|mariadb-server Description: Video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security diff --git a/distros/ubuntu1504_cmake_split_packages/control b/distros/ubuntu1504_cmake_split_packages/control index 1f2b9c3ac..7a3828506 100644 --- a/distros/ubuntu1504_cmake_split_packages/control +++ b/distros/ubuntu1504_cmake_split_packages/control @@ -86,7 +86,7 @@ Section: web Architecture: any Depends: zoneminder-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, debconf, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, - php5, php5-mysql | php5-mysqlnd + php5, php5-mysql | php5-mysqlnd, php-gd Description: Essential files for ZoneMinder's web user interface ZoneMinder is a video camera security and surveillance solution. . From 424b7d50bd9f8cf51ff9aa871b6b688609f90846 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 16 Jul 2015 13:59:06 -0400 Subject: [PATCH 5/6] php-gd should isntead be php5-gd --- distros/debian/control | 2 +- distros/debian8/control | 2 +- distros/debian_cmake/control | 2 +- distros/ubuntu1204/control | 2 +- distros/ubuntu1504/control | 2 +- distros/ubuntu1504_cmake_split_packages/control | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/distros/debian/control b/distros/debian/control index 69b7c7bed..70d03eaa5 100644 --- a/distros/debian/control +++ b/distros/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.4 Package: zoneminder Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53 | libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl, php-gd +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53 | libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl, php5-gd Recommends: mysql-server|mariadb-server Description: Video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security diff --git a/distros/debian8/control b/distros/debian8/control index 47613b6a5..af5ba9ad0 100644 --- a/distros/debian8/control +++ b/distros/debian8/control @@ -86,7 +86,7 @@ Section: web Architecture: any Depends: zoneminder-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, debconf, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, - php5, php5-mysql | php5-mysqlnd, php-gd + php5, php5-mysql | php5-mysqlnd, php5-gd Description: Essential files for ZoneMinder's web user interface ZoneMinder is a video camera security and surveillance solution. . diff --git a/distros/debian_cmake/control b/distros/debian_cmake/control index 92d25e897..94f612ce7 100644 --- a/distros/debian_cmake/control +++ b/distros/debian_cmake/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.4 Package: zoneminder Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2 | httpd, libapache2-mod-php5 | libapache2-mod-fcgid | php5-fpm, php5-mysqlnd | php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client | mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, php-gd +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2 | httpd, libapache2-mod-php5 | libapache2-mod-fcgid | php5-fpm, php5-mysqlnd | php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client | mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, php5-gd Recommends: mysql-server | mariadb-server Description: Video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security diff --git a/distros/ubuntu1204/control b/distros/ubuntu1204/control index 599aef4d0..170504b5a 100644 --- a/distros/ubuntu1204/control +++ b/distros/ubuntu1204/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.4 Package: zoneminder Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client|mysql-client-5.6, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, libavdevice53 | libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl, php-gd +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client|mysql-client-5.6, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, libavdevice53 | libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl, php5-gd Recommends: mysql-server|mariadb-server Description: Video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security diff --git a/distros/ubuntu1504/control b/distros/ubuntu1504/control index 8922489e5..142ec783c 100644 --- a/distros/ubuntu1504/control +++ b/distros/ubuntu1504/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.4 Package: zoneminder Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client|mysql-client-5.6, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, libavdevice-ffmpeg56, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl, php-gd +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client|mysql-client-5.6, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, libavdevice-ffmpeg56, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore5 | libvlccore7 | libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libpolkit-gobject-1-0, liburi-encode-perl, php5-gd Recommends: mysql-server|mariadb-server Description: Video camera security and surveillance solution ZoneMinder is intended for use in single or multi-camera video security diff --git a/distros/ubuntu1504_cmake_split_packages/control b/distros/ubuntu1504_cmake_split_packages/control index 7a3828506..0e16fd5ca 100644 --- a/distros/ubuntu1504_cmake_split_packages/control +++ b/distros/ubuntu1504_cmake_split_packages/control @@ -86,7 +86,7 @@ Section: web Architecture: any Depends: zoneminder-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, debconf, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, - php5, php5-mysql | php5-mysqlnd, php-gd + php5, php5-mysql | php5-mysqlnd, php5-gd Description: Essential files for ZoneMinder's web user interface ZoneMinder is a video camera security and surveillance solution. . From 60410c98d6c20988a012da7f68995be7889f3b2c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 16 Jul 2015 16:44:09 -0400 Subject: [PATCH 6/6] use new db functions in zm_config.cpp --- src/zm_config.cpp | 25 ++++--------------------- src/zm_db.cpp | 3 ++- src/zm_db.h | 2 +- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/zm_config.cpp b/src/zm_config.cpp index f8ae0c271..e9c54b943 100644 --- a/src/zm_config.cpp +++ b/src/zm_config.cpp @@ -115,30 +115,13 @@ void zmLoadConfig() if ( ! staticConfig.SERVER_ID ) { if ( ! staticConfig.SERVER_NAME.empty() ) { + std::string sql = stringtf("SELECT Id FROM Servers WHERE Name='%s'", staticConfig.SERVER_NAME.c_str() ); - if ( mysql_query( &dbconn, sql.c_str() ) ) - { - Error( "Can't run query: %s", mysql_error( &dbconn ) ); - Fatal("Can't get ServerId for Server %s", staticConfig.SERVER_NAME.c_str() ); - } - MYSQL_RES *result = mysql_store_result( &dbconn ); - if ( !result ) - { - Error( "Can't use query result: %s", mysql_error( &dbconn ) ); - Fatal("Can't get ServerId for Server %s", staticConfig.SERVER_NAME.c_str() ); - } - int n_rows = mysql_num_rows( result ); - if ( n_rows != 1 ) - { - Error( "Bogus number of lines return from Server lookup, %d, returned. Can't reload", n_rows ); - Fatal("Can't get ServerId for Server %s", staticConfig.SERVER_NAME.c_str() ); - } - - if ( MYSQL_ROW dbrow = mysql_fetch_row( result ) ) - { + if ( MYSQL_ROW dbrow = zmDbFetchOne( sql.c_str() ) ) { staticConfig.SERVER_ID = atoi(dbrow[0]); + } else { + Fatal("Can't get ServerId for Server %s", staticConfig.SERVER_NAME.c_str() ); } - mysql_free_result( result ); } // end if has SERVER_NAME } else if ( staticConfig.SERVER_NAME.empty() ) { diff --git a/src/zm_db.cpp b/src/zm_db.cpp index 0065488f5..a342ca14b 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -95,7 +95,7 @@ MYSQL_RES * zmDbFetch( const char * query ) { return result; } // end MYSQL_RES * zmDbFetch( const char * query ); -MYSQL_ROW zmDBFetchOne( const char *query ) { +MYSQL_ROW zmDbFetchOne( const char *query ) { MYSQL_RES *result = zmDbFetch( query ); int n_rows = mysql_num_rows( result ); if ( n_rows != 1 ) { @@ -104,6 +104,7 @@ MYSQL_ROW zmDBFetchOne( const char *query ) { } MYSQL_ROW dbrow = mysql_fetch_row( result ); + mysql_free_result( result ); if ( ! dbrow ) { Error("Error getting row from query %s. Error is %s", query, mysql_error( &dbconn ) ); return NULL; diff --git a/src/zm_db.h b/src/zm_db.h index de1a81340..6ec1b5e4e 100644 --- a/src/zm_db.h +++ b/src/zm_db.h @@ -33,7 +33,7 @@ void zmDbConnect(); void zmDbClose(); MYSQL_RES * zmDbFetch( const char *query ); -MYSQL_ROW zmDBFetchOne( const char *query ); +MYSQL_ROW zmDbFetchOne( const char *query ); #ifdef __cplusplus } /* extern "C" */