Commit Graph

80 Commits

Author SHA1 Message Date
Peter Keresztes Schmidt 9e77324de4 Replace raw mysql_query calls with the zmDb* functions
With this we can make sure we have proper locking of our DB connection at all times.
2021-03-06 00:12:18 +01:00
Isaac Connor 6c013f0e65 Put back includes needed on FreeBSD. Fixes #3165 2021-02-22 08:03:10 -05:00
Peter Keresztes Schmidt cc6ea04afe Reformat touched code 2021-02-07 13:55:08 +01:00
Peter Keresztes Schmidt aec4dbc6ff DB: Make connection initialization more predictable and avoid double-initialization
Remove calls to zmDBConnect from various places to avoid possible side-effects/double initialization.
The function should be called once from the main thread of the daemon.

Also split config loading into 2 steps: static and DB config loading. Load the static config before zmDBConnect is called so it has a chance to succeed.
2021-02-07 13:44:41 +01:00
Peter Keresztes Schmidt 0dbc39ee25 Cleanup and reorganize includes
With this commit a unified structure for includes is introduced.
The general rules:
 * Only include what you need
 * Include wherever possible in the cpp and forward-declare in the header

 The includes are sorted in a local to global fashion. This means for the include order:
  0. If cpp file: The corresponding h file and an empty line
  1. Includes from the project sorted alphabetically
  2. System/library includes sorted alphabetically
  3. Conditional includes
2021-02-04 18:02:01 +01:00
Peter Keresztes Schmidt 5a57efdfe2 Replace deprecated C header includes with the C++ ones. 2021-02-04 05:39:03 +01:00
Isaac Connor b261fbb397 Merge branch 'master' into zma_to_thread 2020-12-07 16:26:26 -05:00
Isaac Connor d4253be69f Use proper C++ initializer for Config. Don't copy the sql string, just use it from whereever in ram it is. 2020-11-18 13:15:07 -05:00
Isaac Connor a39a656373 Merge branch 'master' into zma_to_thread 2020-09-29 11:02:40 -04:00
Peter Keresztes Schmidt 8f980a1168 Convert NULL/0 to nullptr
The 0 -> nullptr changes should definitely improve readability.
2020-08-26 22:03:40 +02:00
Peter Keresztes Schmidt 394426cca2 zm_config: Fix a -Wwrite-string warning
For reference:
/home/peterke/DEV/zoneminder/build/src/zm_config.h:31:26: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
2020-08-25 20:51:42 +02:00
Isaac Connor 08aee63f66 Don't need a variable can just pass the define 2020-08-22 11:36:07 -04:00
Isaac Connor 5fb56c9f57 Merge branch 'master' into zma_to_thread 2020-08-07 17:52:43 -04:00
Isaac Connor 27fed8b227 spacing 2020-07-23 11:53:33 -04:00
Isaac Connor 4ff341a0f5 Merge branch 'master' into zma_to_thread 2020-05-02 18:03:42 -04:00
Isaac Connor 2882693791 If can't connect to db, bail instead of loading config 2020-03-04 14:13:44 -05:00
Isaac Connor 09fcbad666 Merge branch 'master' into zma_to_thread 2019-11-30 14:59:39 -05:00
Isaac Connor 54c14b17d7 Spacing and google code style 2019-09-17 10:28:42 -04:00
Isaac Connor 396be10d6f Merge branch 'master' into zma_to_thread 2019-08-22 12:57:00 -04:00
Isaac Connor c7b6db9be7 Put backticks around all columns and tables in sql to deal with mysql 8 2019-08-14 16:18:21 -04:00
Isaac Connor a9e2011727 Merge branch 'storageareas' into zma_to_thread 2019-02-13 12:24:38 -05:00
Andrew Bauer 3258d8e590 remove ZM_DIR_IMAGES (#2374) 2018-12-29 09:52:58 -05:00
Isaac Connor 672b4affe1 Merge branch 'storageareas' into zma_to_thread 2018-08-31 19:05:22 -04:00
Andrew Bauer 3dc424282b Support quoting config variables (#2175)
* allow handling of quotes in config files

* copy paste error

* surround zm_arptool in quotes
2018-08-11 12:56:16 -04:00
Isaac Connor bcdadc67bf Merge branch 'storageareas' into zma_to_thread 2017-12-12 15:29:19 -05:00
Isaac Connor 475d39f1c6 move closedir down so that it always happens. Make coverity quiet 2017-12-12 12:34:43 -05:00
Isaac Connor 74650ebc70 simplify Analysis 2017-11-20 11:48:56 -05:00
Isaac Connor 64816aa005 fixes from cppcheck. 2017-11-18 16:00:10 -05:00
Isaac Connor 7bff9a8083 fix to compile 2017-11-16 20:37:40 -05:00
Isaac Connor a956ffe7b3 add Copy and =operators to satisfy cppcheck 2017-11-16 09:15:04 -05:00
Isaac Connor feca6c3df0 add a copy constructor at the advice of cppcheck 2017-11-12 13:16:18 -05:00
Isaac Connor 666233af54 fix mving capture_file_format to staticCOnfig 2017-10-18 20:46:26 -04:00
Isaac Connor 4b30dd540c tabs to spaces 2017-10-18 10:21:54 -07:00
Isaac Connor b255414bbb Merge branch 'storageareas' into remove_ffmpeg_thread 2017-08-14 11:15:25 -04:00
Isaac Connor 49464d381a Merge branch 'master' into storageareas 2017-08-14 10:44:40 -04:00
ralimi ecb7df0e8b Support SSL for mysql connections (#1965)
* Fix install location for config files when building to alternate directory.

With the previous code, we ended up with a directory structure like the following:

$ find /etc/zm/conf.d/
/etc/zm/conf.d/
/etc/zm/conf.d/01-system-paths.conf
/etc/zm/conf.d/conf.d
/etc/zm/conf.d/conf.d/README
/etc/zm/conf.d/conf.d/02-multiserver.conf

* Omitted README file that should have appeared in /etc/zm/conf.d

* Fix location for configs when building to alternate directory.

* Fix works, but this should go on a branch instead.

* Fix works, but this should go on a branch instead.

* Fix location for configs when building to alternate directory.

With the previous code, we ended up with a directory structure like the following:

$ find /etc/zm/conf.d/
/etc/zm/conf.d/
/etc/zm/conf.d/01-system-paths.conf
/etc/zm/conf.d/conf.d
/etc/zm/conf.d/conf.d/README
/etc/zm/conf.d/conf.d/02-multiserver.conf

* Remove double quotes. This is a list of paths.

* Allow SSL database connection to be secured with SSL.

* Fix incorrect variable name

* Fix PHP syntax errors

* SSL connection parameters must also be passed in API.

* Revert fixes to build files; they should not be in this branch.
2017-08-14 10:30:42 -04:00
Isaac Connor daee5b4450 experiment with no ffmpeg thread 2017-08-11 12:03:37 -04:00
Isaac Connor fdd0e8dc1b fix spacing 2017-07-05 13:08:31 -04:00
Isaac Connor 085d239a6e Merge branch 'master' into storageareas 2017-06-13 18:02:28 -04:00
Andrew Bauer bacf65ae9a Migrate values from Options -> Paths to zm.conf (#1908)
* initial commit to migrate contents of Options->Paths to zm.conf

* remove paths items from configdata.pm

* remove paths tab from options

* update deb packaging scripts with new cmake vars

* remove extraneous file

* save custom paths variables to config file before dB is freshened

* don't check configs if the dB version is >= 1.31.0
2017-06-12 21:39:37 -04:00
Isaac Connor 9669fede18 fix merge by putting back my dbRow object 2017-06-09 10:18:15 -04:00
Andrew Bauer 2bc6f1627e Add support for conf.d subfolder (#1902)
* cmake changes to support conf.d

* php changes to support conf.d

* perl changes to support conf.d

* C changes to support conf.d

* add conf.d support to rpmspecfile

* fix typo

* specify ZM_CONFIG_SUBDIR in relevant target distros

* put back my config_file perl definition

* remove quotes from ZM macros

* fix snprintf

* add README to conf.d folder

* adjust rpm specfile

* remove custom permissions from README in rpmspecfile

* modify rpm README documentation to reflect conf.d support

* set ZM_CONFIG_SUBDIR in debian rules file
2017-06-05 16:39:19 -04:00
Isaac Connor 0a8017b780 whitespace/google code style 2017-05-19 12:24:19 -04:00
Andy Bauer 254fcbcef7 update gpl 2 mailing address in source files 2016-12-26 09:23:16 -06:00
Andy Bauer d12b9dc16d fix typo. needs } 2016-05-24 09:24:18 -05:00
Andy Bauer 6e82f2c9a9 add messages back with debug 3 2016-05-24 08:50:09 -05:00
Andrew Bauer bc163b33fc move multiserver message to once during startup only 2016-05-23 20:06:29 -05:00
Isaac Connor 03b1ced568 tabs to spaces and use 2space indenting 2016-04-04 10:11:48 -04:00
arjunrc e8c38dd016 demoted to debug due to lots of logs 2016-02-11 15:12:21 -05:00
Isaac Connor 3a0b28f168 Add Debug/Info lines reporting multi-server status 2016-01-26 20:53:34 -05:00