diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-10-19 15:02:15 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-10-19 15:02:15 +0000 |
commit | 3742d7428ee114371b5765119a096346a9e37361 (patch) | |
tree | 35bcb9c89d08421a0517c6e690f4232e07acfa99 /includes | |
parent | 98bc18adcd27496d14efd4b664d3483d0b8dc0ce (diff) | |
download | brdo-3742d7428ee114371b5765119a096346a9e37361.tar.gz brdo-3742d7428ee114371b5765119a096346a9e37361.tar.bz2 |
#125105 by Shiny and hwsong3i: fix installer pgsql connection parameters to work when password is not specified
Diffstat (limited to 'includes')
-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); |