Skip to content

Commit

Permalink
add support for db connections with port specified in host
Browse files Browse the repository at this point in the history
  • Loading branch information
gajdy committed Mar 11, 2016
1 parent 7cf952a commit 8fd7ac1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/code/community/Jowens/JobQueue/Model/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ protected function setupDJJob() {
$dsn = "";
if (strpos($config->host, '/') !== false) {
$dsn = "mysql:unix_socket=" . $config->host . ";dbname=" . $config->dbname;
}
elseif (strpos($config->host, ':') !== false) {
list($host, $port) = explode(':', $config->host);
$dsn = "mysql:host=" . $host . ";dbname=" . $config->dbname . ";port=" . $port;
} else {
$dsn = "mysql:host=" . $config->host . ";dbname=" . $config->dbname . ";port=" . $config->port;
}
Expand Down

0 comments on commit 8fd7ac1

Please sign in to comment.