[Pkg-owncloud-commits] [owncloud] 12/223: Work with MySQL Sockets

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:53:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit e77c9bb97ed56d30c08f7d7ea9c06dd80ac9467b
Author: josh4trunks <joshruehlig at gmail.com>
Date:   Wed Jun 4 22:50:23 2014 -0700

    Work with MySQL Sockets
    
    This passes anything that is not a valid port (0<int<65535) as a unix socket.
    I tested this with unix sockets; this needs to be tested with a non-standard mysql port as well but I don't foresee any issues.
    
    To use a unix socket, even one different than PHP's mysql.default_socket..
    * Database Host = localhost:/path/to/socket
---
 lib/private/db.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/private/db.php b/lib/private/db.php
index 422f783..16030a2 100644
--- a/lib/private/db.php
+++ b/lib/private/db.php
@@ -65,6 +65,9 @@ class OC_DB {
 		$type = OC_Config::getValue( "dbtype", "sqlite" );
 		if(strpos($host, ':')) {
 			list($host, $port)=explode(':', $host, 2);
+			if(!is_int($port)||$port<1||$port>65535) {
+				$socket=true;
+			}
 		} else {
 			$port=false;
 		}
@@ -89,7 +92,11 @@ class OC_DB {
 				'dbname' => $name,
 			);
 			if (!empty($port)) {
-				$connectionParams['port'] = $port;
+				if ($socket) {
+					$connectionParams['unix_socket'] = $port;
+				} else {
+					$connectionParams['port'] = $port;
+				}
 			}
 		}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list