Merge branch 'W14_MDL-44862_m26_pgsocket' of git://github.com/skodak/moodle into MOODLE_26_STABLE
This commit is contained in:
@@ -81,7 +81,11 @@ class auth_db_testcase extends advanced_testcase {
|
||||
set_config('sybasequoting', '0', 'auth/db');
|
||||
if (!empty($CFG->dboptions['dbsocket']) and ($CFG->dbhost === 'localhost' or $CFG->dbhost === '127.0.0.1')) {
|
||||
if (strpos($CFG->dboptions['dbsocket'], '/') !== false) {
|
||||
set_config('host', $CFG->dboptions['dbsocket'], 'auth/db');
|
||||
$socket = $CFG->dboptions['dbsocket'];
|
||||
if (!empty($CFG->dboptions['dbport'])) {
|
||||
$socket .= ':' . $CFG->dboptions['dbport'];
|
||||
}
|
||||
set_config('host', $socket, 'auth/db');
|
||||
} else {
|
||||
set_config('host', '', 'auth/db');
|
||||
}
|
||||
|
||||
@@ -82,7 +82,11 @@ class enrol_database_testcase extends advanced_testcase {
|
||||
set_config('dbsybasequoting', '0', 'enrol_database');
|
||||
if (!empty($CFG->dboptions['dbsocket']) and ($CFG->dbhost === 'localhost' or $CFG->dbhost === '127.0.0.1')) {
|
||||
if (strpos($CFG->dboptions['dbsocket'], '/') !== false) {
|
||||
set_config('dbhost', $CFG->dboptions['dbsocket'], 'enrol_database');
|
||||
$socket = $CFG->dboptions['dbsocket'];
|
||||
if (!empty($CFG->dboptions['dbport'])) {
|
||||
$socket .= ':' . $CFG->dboptions['dbport'];
|
||||
}
|
||||
set_config('dbhost', $socket, 'enrol_database');
|
||||
} else {
|
||||
set_config('dbhost', '', 'enrol_database');
|
||||
}
|
||||
|
||||
@@ -135,6 +135,10 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
$connection = "user='$this->dbuser' password='$pass' dbname='$this->dbname'";
|
||||
if (strpos($this->dboptions['dbsocket'], '/') !== false) {
|
||||
$connection = $connection." host='".$this->dboptions['dbsocket']."'";
|
||||
if (!empty($this->dboptions['dbport'])) {
|
||||
// Somehow non-standard port is important for sockets - see MDL-44862.
|
||||
$connection = $connection." port ='".$this->dboptions['dbport']."'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->dboptions['dbsocket'] = '';
|
||||
|
||||
Reference in New Issue
Block a user