]> git.pld-linux.org Git - packages/cacti.git/commitdiff
- allow using mysql sockets when connecting to db
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 24 Jan 2012 09:24:53 +0000 (09:24 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    cacti.spec -> 1.149
    mysql-socket.patch -> 1.1

cacti.spec
mysql-socket.patch [new file with mode: 0644]

index cc64cea6d002d80b935145407381bd7cd31c3af0..f41b3e32d55c6a33877324f149413baaca6167b7 100644 (file)
@@ -3,7 +3,7 @@ Summary:        Cacti is a PHP frontend for rrdtool
 Summary(pl.UTF-8):     Cacti - frontend w PHP do rrdtoola
 Name:          cacti
 Version:       0.8.7i
-Release:       1
+Release:       2
 License:       GPL v2
 Group:         Applications/WWW
 Source0:       http://www.cacti.net/downloads/%{name}-%{version}-PIA-%{pia_ver}.tar.gz
@@ -13,6 +13,7 @@ Source3:      %{name}-apache.conf
 Source4:       %{name}-lighttpd.conf
 Source5:       %{name}-rrdpath.sql
 Source7:       %{name}.logrotate
+Patch0:                mysql-socket.patch
 Patch1:                %{name}-config.patch
 Patch2:                %{name}-adodb.patch
 Patch3:                %{name}-ioerror.patch
@@ -116,6 +117,7 @@ Dokumentacja do Cacti w formacie HTML.
 # official patches
 %patch10 -p1
 
+%patch0 -p1
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
diff --git a/mysql-socket.patch b/mysql-socket.patch
new file mode 100644 (file)
index 0000000..e62cb9c
--- /dev/null
@@ -0,0 +1,26 @@
+--- cacti-0.8.7i-PIA-3.1/lib/database.php~     2011-12-12 03:56:06.000000000 +0200
++++ cacti-0.8.7i-PIA-3.1/lib/database.php      2012-01-24 11:18:39.563094454 +0200
+@@ -34,6 +34,11 @@
+ function db_connect_real($host, $user, $pass, $db_name, $db_type, $port = "3306", $db_ssl = false, $retries = 20) {
+       global $cnn_id;
++      // convert hostname:port to hostname and port
++      if (strchr($host, ':')) {
++              list($host, $port) = explode(':', $host, 2);
++      }
++
+       $i = 0;
+       $dsn = "$db_type://" . rawurlencode($user) . ":" . rawurlencode($pass) . "@" . rawurlencode($host) . "/" . rawurlencode($db_name) . "?persist";
+@@ -43,7 +48,10 @@
+               $dsn .= "&clientflags=" . MYSQLI_CLIENT_SSL;
+       }
+-      if ($port != "3306") {
++      // socket supported for mysqli only, not mysql
++      if ($port && !is_numeric($port) && $db_type == "mysqli") {
++              $dsn .= "&socket=" . $port;
++      } elseif ($port != "3306") {
+               $dsn .= "&port=" . $port;
+       }
This page took 0.046852 seconds and 4 git commands to generate.