Support additional connect parameters in PostgreSQL database wrapper (#6071)

Most notably this change enables you to specify whether or with what
priority a secure SSL TCP/IP connection will be negotiated with the
database server.
pull/6085/head
Georgeto 7 years ago committed by Aleksander Machniak
parent 78aa0efa15
commit 161038ee87

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Support additional connect parameters in PostgreSQL database wrapper
- Use UI dialogs instead of confirm() and alert() where possible
- Display value of the SMTP message size limit in the error message (#6032)
- Skip redundant INSERT query on successful logon when using PHP7

@ -28,6 +28,9 @@ class rcube_db_pgsql extends rcube_db
{
public $db_provider = 'postgres';
// See https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS
private static $libpq_connect_params = array("application_name", "sslmode", "sslcert", "sslkey", "sslrootcert", "sslcrl", "sslcompression", "service");
/**
* Object constructor
*
@ -256,6 +259,12 @@ class rcube_db_pgsql extends rcube_db
$params[] = 'dbname=' . $dsn['database'];
}
foreach (self::$libpq_connect_params as $param) {
if ($dsn[$param]) {
$params[] = $param . '=' . $dsn[$param];
}
}
if (!empty($params)) {
$result .= implode(';', $params);
}

Loading…
Cancel
Save