MDL-44862 postgres: tests to support socket & port
Both the database auth and enrol plugins use ADOdb to perform connections. Socket and port are allowed there if passed as "socket:port", so, when both are configured in CFG, we pass them that way. Else ADOdb defaults to standard port (5432).
This commit is contained in:
committed by
Petr Škoda
parent
64b18f75b9
commit
dd693b76fa
@@ -80,7 +80,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');
|
||||
}
|
||||
|
||||
@@ -81,7 +81,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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user