Merge branch 'master' into add_user_to_filters
This commit is contained in:
commit
a719565bf3
|
@ -309,14 +309,9 @@ sub Sql {
|
||||||
} # end if terms
|
} # end if terms
|
||||||
|
|
||||||
if ( $self->{Sql} ) {
|
if ( $self->{Sql} ) {
|
||||||
if ( $self->{AutoMessage} ) {
|
|
||||||
# Include all events, including events that are still ongoing
|
# Include all events, including events that are still ongoing
|
||||||
# and have no EndTime yet
|
# and have no EndTime yet
|
||||||
$sql .= ' WHERE ( '.$self->{Sql}.' )';
|
$sql .= ' WHERE ( '.$self->{Sql}.' )';
|
||||||
} else {
|
|
||||||
# Only include closed events (events with valid EndTime)
|
|
||||||
$sql .= ' WHERE (E.EndTime IS NOT NULL) AND ( '.$self->{Sql}.' )';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
my @auto_terms;
|
my @auto_terms;
|
||||||
if ( $self->{AutoArchive} ) {
|
if ( $self->{AutoArchive} ) {
|
||||||
|
|
|
@ -30,22 +30,23 @@ require_once('logger.php');
|
||||||
function dbConnect() {
|
function dbConnect() {
|
||||||
global $dbConn;
|
global $dbConn;
|
||||||
|
|
||||||
$socket = '';
|
$dsn = ZM_DB_TYPE;
|
||||||
if ( ZM_DB_HOST ) {
|
if ( ZM_DB_HOST ) {
|
||||||
if ( strpos(ZM_DB_HOST, ':') ) {
|
if ( strpos(ZM_DB_HOST, ':') ) {
|
||||||
// Host variable may carry a port or socket.
|
// Host variable may carry a port or socket.
|
||||||
list($host, $portOrSocket) = explode(':', ZM_DB_HOST, 2);
|
list($host, $portOrSocket) = explode(':', ZM_DB_HOST, 2);
|
||||||
if ( ctype_digit($portOrSocket) ) {
|
if ( ctype_digit($portOrSocket) ) {
|
||||||
$socket = ':host='.$host . ';port='.$portOrSocket.';';
|
$dsn .= ':host='.$host.';port='.$portOrSocket.';';
|
||||||
} else {
|
} else {
|
||||||
$socket = ':unix_socket='.$portOrSocket.';';
|
$dsn .= ':unix_socket='.$portOrSocket.';';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$socket = ':host='.ZM_DB_HOST.';';
|
$dsn .= ':host='.ZM_DB_HOST.';';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$socket = ':host=localhost;';
|
$dsn .= ':host=localhost;';
|
||||||
}
|
}
|
||||||
|
$dsn .= 'dbname='.ZM_DB_NAME;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dbOptions = null;
|
$dbOptions = null;
|
||||||
|
@ -55,15 +56,15 @@ function dbConnect() {
|
||||||
PDO::MYSQL_ATTR_SSL_KEY => ZM_DB_SSL_CLIENT_KEY,
|
PDO::MYSQL_ATTR_SSL_KEY => ZM_DB_SSL_CLIENT_KEY,
|
||||||
PDO::MYSQL_ATTR_SSL_CERT => ZM_DB_SSL_CLIENT_CERT,
|
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 {
|
} 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_EMULATE_PREPARES, false);
|
||||||
$dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
} catch(PDOException $ex) {
|
} 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());
|
error_log('Unable to connect to ZM DB ' . $ex->getMessage());
|
||||||
$dbConn = null;
|
$dbConn = null;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +72,7 @@ function dbConnect() {
|
||||||
} // end function dbConnect
|
} // end function dbConnect
|
||||||
|
|
||||||
if ( !dbConnect() ) {
|
if ( !dbConnect() ) {
|
||||||
ZM\Fatal("Failed db connection to $socket");
|
ZM\Fatal('Failed db connection');
|
||||||
}
|
}
|
||||||
|
|
||||||
function dbDisconnect() {
|
function dbDisconnect() {
|
||||||
|
|
|
@ -100,14 +100,17 @@ class Logger {
|
||||||
$tempDatabaseLevel = $options['databaseLevel'];
|
$tempDatabaseLevel = $options['databaseLevel'];
|
||||||
else
|
else
|
||||||
$tempDatabaseLevel = ZM_LOG_LEVEL_DATABASE;
|
$tempDatabaseLevel = ZM_LOG_LEVEL_DATABASE;
|
||||||
|
|
||||||
if ( isset($options['fileLevel']) )
|
if ( isset($options['fileLevel']) )
|
||||||
$tempFileLevel = $options['fileLevel'];
|
$tempFileLevel = $options['fileLevel'];
|
||||||
else
|
else
|
||||||
$tempFileLevel = ZM_LOG_LEVEL_FILE;
|
$tempFileLevel = ZM_LOG_LEVEL_FILE;
|
||||||
|
|
||||||
if ( isset($options['weblogLevel']) )
|
if ( isset($options['weblogLevel']) )
|
||||||
$tempWeblogLevel = $options['weblogLevel'];
|
$tempWeblogLevel = $options['weblogLevel'];
|
||||||
else
|
else
|
||||||
$tempWeblogLevel = ZM_LOG_LEVEL_WEBLOG;
|
$tempWeblogLevel = ZM_LOG_LEVEL_WEBLOG;
|
||||||
|
|
||||||
if ( isset($options['syslogLevel']) )
|
if ( isset($options['syslogLevel']) )
|
||||||
$tempSyslogLevel = $options['syslogLevel'];
|
$tempSyslogLevel = $options['syslogLevel'];
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue