]> git.mjollnir.org Git - moodle.git/commitdiff
Proper connection exception handling in the DB functional tests.
authorstronk7 <stronk7>
Wed, 2 Sep 2009 16:24:43 +0000 (16:24 +0000)
committerstronk7 <stronk7>
Wed, 2 Sep 2009 16:24:43 +0000 (16:24 +0000)
admin/report/unittest/dbtest.php

index cf9feab31784f2155b6996f44ee799d01756aa95..574fcdb966a8a76c7636835922fc600956497304 100644 (file)
@@ -54,13 +54,16 @@ for ($i=1; $i<=10; $i++) {
     }
     $dbinfos[$i]['installed'] = true;
 
-    if ($d->connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions)) {
+    try {
+        $d->connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions);
         $dbinfos[$i]['configured'] = true;
         if (data_submitted() and !empty($selected[$i])) {
             $tests[$i] = $d;
         } else {
             $d->dispose();
         }
+    } catch (dml_connection_exception $e) {
+        $dbinfos[$i]['configured'] = false;
     }
 }