// create test database
self::$utils = new Utils($GLOBALS['mysql_host'],
+ $GLOBALS['mysql_port'],
$GLOBALS['mysql_user'],
$GLOBALS['mysql_pass']
);
*/
function foreignKeyChecksOff() {
self::$utils = new Utils($GLOBALS['mysql_host'],
+ $GLOBALS['mysql_port'],
$GLOBALS['mysql_user'],
$GLOBALS['mysql_pass']
);
$dsninfo = DB::parseDSN(CIVICRM_DSN);
$GLOBALS['mysql_host'] = $dsninfo['hostspec'];
+$GLOBALS['mysql_port'] = @$dsninfo['port'];
$GLOBALS['mysql_user'] = $dsninfo['username'];
$GLOBALS['mysql_pass'] = $dsninfo['password'];
$GLOBALS['mysql_db'] = $dsninfo['database'];
-
/**
* Content Management System (CMS) Host:
*
/**
* Construct an object for this database
*/
- public function __construct($host, $user, $pass) {
+ public function __construct($host, $port, $user, $pass) {
try {
- $this->pdo = new PDO("mysql:host={$host}",
+ $this->pdo = new PDO("mysql:host={$host}" . ($port ? ";port=$port" : ""),
$user, $pass,
array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE)
);