MDL-34309: Fix broken postgres unix sockets in core_adodb_testcase::test_read_table
authorAshley Holman <ashley@netspot.com.au>
Thu, 12 Jul 2012 13:48:51 +0000 (23:18 +0930)
committerSam Hemelryk <sam@moodle.com>
Sun, 15 Jul 2012 21:33:01 +0000 (09:33 +1200)
enrol/database/tests/adodb_test.php

index 2336d53..7f30c07 100644 (file)
@@ -70,7 +70,11 @@ class core_adodb_testcase extends advanced_testcase {
                 set_config('dbsetupsql', 'SET NAMES \'UTF-8\'', 'enrol_database');
                 set_config('dbsybasequoting', '0', 'enrol_database');
                 if (!empty($CFG->dboptions['dbsocket']) and ($CFG->dbhost === 'localhost' or $CFG->dbhost === '127.0.0.1')) {
-                    set_config('dbhost', $CFG->dboptions['dbsocket'], 'enrol_database');
+                    if (strpos($CFG->dboptions['dbsocket'], '/') !== false) {
+                      set_config('dbhost', $CFG->dboptions['dbsocket'], 'enrol_database');
+                    } else {
+                      set_config('dbhost', '', 'enrol_database');
+                    }
                 }
                 break;