Commit 6576413e authored by Eloy Lafuente's avatar Eloy Lafuente Committed by Petr Škoda
Browse files

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).
parent 96255f47
......@@ -87,7 +87,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');
}
......
......@@ -89,7 +89,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');
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment