diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm index 568d303e9..91b87e615 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm @@ -309,14 +309,9 @@ sub Sql { } # end if terms if ( $self->{Sql} ) { - if ( $self->{AutoMessage} ) { # Include all events, including events that are still ongoing # and have no EndTime yet - $sql .= ' WHERE ( '.$self->{Sql}.' )'; - } else { -# Only include closed events (events with valid EndTime) - $sql .= ' WHERE (E.EndTime IS NOT NULL) AND ( '.$self->{Sql}.' )'; - } + $sql .= ' WHERE ( '.$self->{Sql}.' )'; } my @auto_terms; if ( $self->{AutoArchive} ) { diff --git a/web/includes/database.php b/web/includes/database.php index 2fb2db108..7404d085e 100644 --- a/web/includes/database.php +++ b/web/includes/database.php @@ -30,22 +30,23 @@ require_once('logger.php'); function dbConnect() { global $dbConn; - $socket = ''; + $dsn = ZM_DB_TYPE; if ( ZM_DB_HOST ) { if ( strpos(ZM_DB_HOST, ':') ) { // Host variable may carry a port or socket. list($host, $portOrSocket) = explode(':', ZM_DB_HOST, 2); if ( ctype_digit($portOrSocket) ) { - $socket = ':host='.$host . ';port='.$portOrSocket.';'; + $dsn .= ':host='.$host.';port='.$portOrSocket.';'; } else { - $socket = ':unix_socket='.$portOrSocket.';'; + $dsn .= ':unix_socket='.$portOrSocket.';'; } } else { - $socket = ':host='.ZM_DB_HOST.';'; + $dsn .= ':host='.ZM_DB_HOST.';'; } } else { - $socket = ':host=localhost;'; + $dsn .= ':host=localhost;'; } + $dsn .= 'dbname='.ZM_DB_NAME; try { $dbOptions = null; @@ -55,15 +56,15 @@ function dbConnect() { PDO::MYSQL_ATTR_SSL_KEY => ZM_DB_SSL_CLIENT_KEY, PDO::MYSQL_ATTR_SSL_CERT => ZM_DB_SSL_CLIENT_CERT, ); - $dbConn = new PDO(ZM_DB_TYPE.$socket.'dbname='.ZM_DB_NAME, ZM_DB_USER, ZM_DB_PASS, $dbOptions); + $dbConn = new PDO($dsn, ZM_DB_USER, ZM_DB_PASS, $dbOptions); } else { - $dbConn = new PDO(ZM_DB_TYPE.$socket.'dbname='.ZM_DB_NAME, ZM_DB_USER, ZM_DB_PASS); + $dbConn = new PDO($dsn, ZM_DB_USER, ZM_DB_PASS); } $dbConn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $ex) { - echo 'Unable to connect to ZM db.' . $ex->getMessage(); + echo "Unable to connect to ZM db using dsn $dsn host".ZM_DB_HOST.' user: ('.ZM_DB_USER.') password ('.ZM_DB_PASS.': '.$ex->getMessage(); error_log('Unable to connect to ZM DB ' . $ex->getMessage()); $dbConn = null; } @@ -71,7 +72,7 @@ function dbConnect() { } // end function dbConnect if ( !dbConnect() ) { - ZM\Fatal("Failed db connection to $socket"); + ZM\Fatal('Failed db connection'); } function dbDisconnect() { diff --git a/web/includes/logger.php b/web/includes/logger.php index c12ee3477..b616f7458 100644 --- a/web/includes/logger.php +++ b/web/includes/logger.php @@ -100,14 +100,17 @@ class Logger { $tempDatabaseLevel = $options['databaseLevel']; else $tempDatabaseLevel = ZM_LOG_LEVEL_DATABASE; + if ( isset($options['fileLevel']) ) $tempFileLevel = $options['fileLevel']; else $tempFileLevel = ZM_LOG_LEVEL_FILE; + if ( isset($options['weblogLevel']) ) $tempWeblogLevel = $options['weblogLevel']; else $tempWeblogLevel = ZM_LOG_LEVEL_WEBLOG; + if ( isset($options['syslogLevel']) ) $tempSyslogLevel = $options['syslogLevel']; else