]> git.pld-linux.org Git - packages/cacti.git/blob - mysql-socket.patch
- allow adodb mysql driver in the future support socket too
[packages/cacti.git] / mysql-socket.patch
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
3 @@ -34,6 +34,11 @@
4  function db_connect_real($host, $user, $pass, $db_name, $db_type, $port = "3306", $db_ssl = false, $retries = 20) {
5         global $cnn_id;
6  
7 +       // convert hostname:port to hostname and port
8 +       if (strchr($host, ':')) {
9 +               list($host, $port) = explode(':', $host, 2);
10 +       }
11 +
12         $i = 0;
13         $dsn = "$db_type://" . rawurlencode($user) . ":" . rawurlencode($pass) . "@" . rawurlencode($host) . "/" . rawurlencode($db_name) . "?persist";
14  
15 @@ -43,7 +48,10 @@
16                 $dsn .= "&clientflags=" . MYSQLI_CLIENT_SSL;
17         }
18  
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;
25         }
26  
This page took 0.048399 seconds and 4 git commands to generate.