summaryrefslogtreecommitdiff
path: root/installer/installer.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-11-12 14:42:37 -0800
committerTim Almdal <tnalmdal@shaw.ca>2009-11-12 14:42:37 -0800
commit393896a7010bf2da19674aa6a63a693a0d800233 (patch)
tree10f1705ebdfa1db45d327851a340ef05e42f072c /installer/installer.php
parenta5a8cfd1bc7cd03c224c731c3ff433eec033457d (diff)
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
Diffstat (limited to 'installer/installer.php')
-rw-r--r--installer/installer.php6
1 files changed, 4 insertions, 2 deletions
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) {