Author: glen                         Date: Tue Jan 24 09:24:59 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- allow using mysql sockets when connecting to db

---- Files affected:
packages/cacti:
   cacti.spec (1.148 -> 1.149) , mysql-socket.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/cacti/cacti.spec
diff -u packages/cacti/cacti.spec:1.148 packages/cacti/cacti.spec:1.149
--- packages/cacti/cacti.spec:1.148     Mon Jan 23 17:39:02 2012
+++ packages/cacti/cacti.spec   Tue Jan 24 10:24:53 2012
@@ -4,7 +4,7 @@
 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
@@ -14,6 +14,7 @@
 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
@@ -117,6 +118,7 @@
 # official patches
 %patch10 -p1
 
+%patch0 -p1
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
@@ -267,6 +269,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.149  2012/01/24 09:24:53  glen
+- allow using mysql sockets when connecting to db
+
 Revision 1.148  2012/01/23 16:39:02  glen
 - up to 0.8.7i; use consolidated PIA tarball; requires boost 5.x according to 
changelog
 

================================================================
Index: packages/cacti/mysql-socket.patch
diff -u /dev/null packages/cacti/mysql-socket.patch:1.1
--- /dev/null   Tue Jan 24 10:24:59 2012
+++ packages/cacti/mysql-socket.patch   Tue Jan 24 10:24:53 2012
@@ -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;
+       }
+ 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti/cacti.spec?r1=1.148&r2=1.149&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to