diff --git a/distros/debian/control b/distros/debian/control index 285c2257c..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 +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 efa9ecef2..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 + 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 01adf14df..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 +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/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) diff --git a/distros/ubuntu1204/control b/distros/ubuntu1204/control index b1be82b34..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 +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 5b63046c3..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 +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 1f2b9c3ac..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 + 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/scripts/zmtrigger.pl.in b/scripts/zmtrigger.pl.in index 2dfbe3ed7..2d0afb13c 100644 --- a/scripts/zmtrigger.pl.in +++ b/scripts/zmtrigger.pl.in @@ -522,7 +522,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} ); 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 4ebc2f11f..a342ca14b 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -75,3 +75,39 @@ 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 ); + mysql_free_result( 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..6ec1b5e4e 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