MDL-59509 dml: sqlsrv should respect port setting

Details of how to connect to a specific port are available at
https://docs.microsoft.com/en-us/sql/connect/php/how-to-connect-on-a-specified-port
This commit is contained in:
Andrew Nicols 2017-07-21 13:23:15 +08:00
parent 16a68a2f76
commit e879619477

View file

@ -182,7 +182,13 @@ class sqlsrv_native_moodle_database extends moodle_database {
sqlsrv_configure("LogSeverity", SQLSRV_LOG_SEVERITY_ERROR);
$this->store_settings($dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions);
$this->sqlsrv = sqlsrv_connect($this->dbhost, array
$dbhost = $this->dbhost;
if (!empty($dboptions['dbport'])) {
$dbhost .= ',' . $dboptions['dbport'];
}
$this->sqlsrv = sqlsrv_connect($dbhost, array
(
'UID' => $this->dbuser,
'PWD' => $this->dbpass,