Skip to content

Commit

Permalink
Fix connection to posgtres db using unix socket (#1489132)
Browse files Browse the repository at this point in the history
Conflicts:

	CHANGELOG
  • Loading branch information
alecpl committed May 29, 2013
1 parent 7b81cdb commit 983308e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================

- Fix connection to posgtres db using unix socket (#1489132)
- Fix handling of comma when adding contact from contacts widget (#1489107)
- Fix bug where a message was opened in both preview pane and new window on double-click (#1489122)
- Fix fatal error when xdebug.max_nesting_level was exceeded in rcube_washtml (#1489110)
Expand Down
34 changes: 34 additions & 0 deletions program/lib/Roundcube/rcube_db_pgsql.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,38 @@ public function get_variable($varname, $default = null)
return isset($this->variables[$varname]) ? $this->variables[$varname] : $default;
}

/**
* Returns PDO DSN string from DSN array
*
* @param array $dsn DSN parameters
*
* @return string DSN string
*/
protected function dsn_string($dsn)
{
$params = array();
$result = 'pgsql:';

if ($dsn['hostspec']) {
$params[] = 'host=' . $dsn['hostspec'];
}
else if ($dsn['socket']) {
$params[] = 'host=' . $dsn['socket'];
}

if ($dsn['port']) {
$params[] = 'port=' . $dsn['port'];
}

if ($dsn['database']) {
$params[] = 'dbname=' . $dsn['database'];
}

if (!empty($params)) {
$result .= implode(';', $params);
}

return $result;
}

}

0 comments on commit 983308e

Please sign in to comment.