[Plugin: PostgreSQL for WordPress (PG4WP)] Alternative port in conection
-
I changed driver_pgsql.php to allow an alternative port in connection. Now can connect with host:port
function wpsql_connect($dbserver, $dbuser, $dbpass) {
$GLOBALS[‘pg4wp_connstr’] = ”;
if (!empty($dbserver)) {
$hostAndPort = explode(‘:’, $dbserver);
$GLOBALS[‘pg4wp_connstr’] .= ‘ host=’ . $hostAndPort[0];
if(isset($hostAndPort[1])){
$GLOBALS[‘pg4wp_connstr’] .= ‘ port=’ . $hostAndPort[1];
}
}
if (!empty($dbuser))
$GLOBALS[‘pg4wp_connstr’] .= ‘ user=’ . $dbuser;
if (!empty($dbpass))
$GLOBALS[‘pg4wp_connstr’] .= ‘ password=’ . $dbpass;
elseif (!PG4WP_INSECURE)
wp_die(‘Connecting to your PostgreSQL database without a password is considered insecure.If you want to do it anyway, please set “PG4WP_INSECURE” to true in your “db.php” file.’);
// While installing, we test the connection to ‘template1’ (as we don’t know the effective dbname yet)
if (defined(‘WP_INSTALLING’) && WP_INSTALLING)
return wpsql_select_db(‘template1’);return 1;
}https://www.ads-software.com/extend/plugins/postgresql-for-wordpress/
- The topic ‘[Plugin: PostgreSQL for WordPress (PG4WP)] Alternative port in conection’ is closed to new replies.