From 393896a7010bf2da19674aa6a63a693a0d800233 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 12 Nov 2009 14:42:37 -0800 Subject: Initialize the database config with the port number if it is specified. Also set it up so the mysqli constructor will split it into host and port for the call to the mysqli constructor. Fixes ticket: #780 --- installer/installer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'installer/installer.php') diff --git a/installer/installer.php b/installer/installer.php index 70afc440..3b1716e2 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -77,7 +77,8 @@ class installer { // counterparts. if (!function_exists("mysql_query")) { function mysql_connect($host, $user, $pass) { - installer::$mysqli = new mysqli($host, $user, $pass); + list ($host, $port) = explode(":", $host); + installer::$mysqli = new mysqli($host, $user, $pass, $port); // http://php.net/manual/en/mysqli.connect.php says to use mysqli_connect_error() instead of // $mysqli->connect_error because of bugs before PHP 5.2.9 $error = mysqli_connect_error(); @@ -97,7 +98,8 @@ class installer { } } - return @mysql_connect($config["host"], $config["user"], $config["password"]); + $host = empty($config["port"]) ? $config['host'] : "{$config['host']}:{$config['port']}"; + return @mysql_connect($host, $config["user"], $config["password"]); } static function select_db($config) { -- cgit v1.2.3