mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
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:
parent
96255f472c
commit
6576413e48
@ -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');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user