Commit 6da77203 by Scott

Merge pull request #388 from dreamon11/support-wordpress-host-port

Support Wordpress host port
parents d2241bdd c58736a5
......@@ -61,8 +61,21 @@
// in mysqli we connect and select database in constructor
$host = QA_PERSISTENT_CONN_DB ? 'p:'.QA_FINAL_MYSQL_HOSTNAME : QA_FINAL_MYSQL_HOSTNAME;
if (defined('QA_FINAL_MYSQL_PORT'))
$db = new mysqli($host, QA_FINAL_MYSQL_USERNAME, QA_FINAL_MYSQL_PASSWORD, QA_FINAL_MYSQL_DATABASE, QA_FINAL_MYSQL_PORT);
$port = null;
if (defined('QA_FINAL_WORDPRESS_INTEGRATE_PATH')) {
$host_and_port = preg_split('/:/', $host);
if (count($host_and_port) == 2) {
$host = QA_PERSISTENT_CONN_DB ? 'p:' . $host_and_port[0] : $host_and_port[0];
$port = $host_and_port[1];
}
} elseif (defined('QA_FINAL_MYSQL_PORT')) {
$port = QA_FINAL_MYSQL_PORT;
}
if (!is_null($port))
$db = new mysqli($host, QA_FINAL_MYSQL_USERNAME, QA_FINAL_MYSQL_PASSWORD, QA_FINAL_MYSQL_DATABASE, $port);
else
$db = new mysqli($host, QA_FINAL_MYSQL_USERNAME, QA_FINAL_MYSQL_PASSWORD, QA_FINAL_MYSQL_DATABASE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment