Merge branch 'MDL-59509-master' of git://github.com/andrewnicols/moodle
authorDavid Monllao <david.monllao@gmail.com>
Mon, 24 Jul 2017 11:03:10 +0000 (13:03 +0200)
committerDavid Monllao <david.monllao@gmail.com>
Mon, 24 Jul 2017 11:03:10 +0000 (13:03 +0200)
lib/dml/sqlsrv_native_moodle_database.php

index 623d628..b80191c 100644 (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,