diff options
-rw-r--r-- | includes/install.pgsql.inc | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/includes/install.pgsql.inc b/includes/install.pgsql.inc index 935622e49..55473f27d 100644 --- a/includes/install.pgsql.inc +++ b/includes/install.pgsql.inc @@ -26,16 +26,24 @@ function drupal_test_pgsql($url, &$success) { } $url = parse_url($url); + $conn_string = ''; - // Decode url-encoded information in the db connection string. - $url['user'] = urldecode($url['user']); - $url['pass'] = urldecode($url['pass']); - $url['host'] = urldecode($url['host']); - $url['path'] = urldecode($url['path']); - - // Build pgsql connection string and allow for non-standard PostgreSQL port. - $conn_string = ' user='. $url['user'] .' dbname='. substr($url['path'], 1) .' password='. $url['pass'] .' host='. $url['host']; - $conn_string .= isset($url['port']) ? ' port='. $url['port'] : ''; + // Decode url-encoded information in the db connection string + if (isset($url['user'])) { + $conn_string .= ' user='. urldecode($url['user']); + } + if (isset($url['pass'])) { + $conn_string .= ' password='. urldecode($url['pass']); + } + if (isset($url['host'])) { + $conn_string .= ' host='. urldecode($url['host']); + } + if (isset($url['path'])) { + $conn_string .= ' dbname='. substr(urldecode($url['path']), 1); + } + if (isset($url['port'])) { + $conn_string .= ' port='. urldecode($url['port']); + } // Test connecting to the database. $connection = @pg_connect($conn_string); |