]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/setup_functions.php
Merge pull request #1334 from mtmail/fix-PDOException-call
[nominatim.git] / lib / setup_functions.php
index b1417678269d9f49d57a0e439de01ee68ed37bf1..89736ae0515c53039403014a3180e9413e09e18d 100755 (executable)
@@ -24,15 +24,17 @@ function checkModulePresence()
     $sSQL .= $sModulePath . "/nominatim.so', 'transliteration' LANGUAGE c IMMUTABLE STRICT";
     $sSQL .= ';DROP FUNCTION nominatim_test_import_func(text);';
 
-    $oDB = &getDB();
-    $oResult = $oDB->query($sSQL);
+    $oDB = new \Nominatim\DB();
+    $oDB->connect();
 
     $bResult = true;
-
-    if (PEAR::isError($oResult)) {
+    try {
+        $oDB->exec($sSQL);
+    } catch (\Nominatim\DatabaseError $e) {
         echo "\nERROR: Failed to load nominatim module. Reason:\n";
-        echo $oResult->userinfo . "\n\n";
+        echo $oDB->getLastError()[2] . "\n\n";
         $bResult = false;
     }
+
     return $bResult;
 }