Skip to content

Commit 34044c7

Browse files
committed
Fix missing port for mysql connection
1 parent d505063 commit 34044c7

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/app/CliTools/Console/Command/Sync/AbstractCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,18 @@ protected function initializeConfiguration()
159159
protected function initDatabaseConfiguration()
160160
{
161161
$hostname = DatabaseConnection::getDbHostname();
162+
$port = DatabaseConnection::getDbPort();
162163
$username = DatabaseConnection::getDbUsername();
163164
$password = DatabaseConnection::getDbPassword();
164165

165166
if ($this->config->exists('LOCAL.mysql.hostname')) {
166167
$hostname = $this->config->get('LOCAL.mysql.hostname');
167168
}
168169

170+
if ($this->config->exists('LOCAL.mysql.port')) {
171+
$port = $this->config->get('LOCAL.mysql.port');
172+
}
173+
169174
if ($this->config->exists('LOCAL.mysql.username')) {
170175
$username = $this->config->get('LOCAL.mysql.username');
171176
}
@@ -174,7 +179,9 @@ protected function initDatabaseConfiguration()
174179
$password = $this->config->get('LOCAL.mysql.password');
175180
}
176181

177-
DatabaseConnection::setDsn('mysql:host=' . $hostname, $username, $password);
182+
$dsn = 'mysql:host=' . urlencode($hostname) . ';port=' . (int)$port;
183+
184+
DatabaseConnection::setDsn($dsn, $username, $password);
178185
}
179186

180187
/**

0 commit comments

Comments
 (0)