1 --- cacti-0.8.7i-PIA-3.1/lib/database.php~ 2011-12-12 03:56:06.000000000 +0200
2 +++ cacti-0.8.7i-PIA-3.1/lib/database.php 2012-01-24 11:18:39.563094454 +0200
4 function db_connect_real($host, $user, $pass, $db_name, $db_type, $port = "3306", $db_ssl = false, $retries = 20) {
7 + // convert hostname:port to hostname and port
8 + if (strchr($host, ':')) {
9 + list($host, $port) = explode(':', $host, 2);
13 $dsn = "$db_type://" . rawurlencode($user) . ":" . rawurlencode($pass) . "@" . rawurlencode($host) . "/" . rawurlencode($db_name) . "?persist";
16 $dsn .= "&clientflags=" . MYSQLI_CLIENT_SSL;
19 - if ($port != "3306") {
20 + // socket supported for mysqli only, not mysql
21 + if ($port && !is_numeric($port)) {
22 + $dsn .= "&socket=" . $port;
23 + } elseif ($port != "3306") {
24 $dsn .= "&port=" . $port;