]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/setup_functions.php
probe for php_cgi in cmake to be used for querying
[nominatim.git] / lib / setup_functions.php
index b1417678269d9f49d57a0e439de01ee68ed37bf1..dc84cf92852df0a98765cad45f2adfd39d261571 100755 (executable)
@@ -15,24 +15,20 @@ function checkInFile($sOSMFile)
     }
 }
 
-function checkModulePresence()
+function getOsm2pgsqlBinary()
 {
-    // Try accessing the C module, so we know early if something is wrong
-    // and can simply error out.
-    $sModulePath = CONST_Database_Module_Path;
-    $sSQL = "CREATE FUNCTION nominatim_test_import_func(text) RETURNS text AS '";
-    $sSQL .= $sModulePath . "/nominatim.so', 'transliteration' LANGUAGE c IMMUTABLE STRICT";
-    $sSQL .= ';DROP FUNCTION nominatim_test_import_func(text);';
-
-    $oDB = &getDB();
-    $oResult = $oDB->query($sSQL);
-
-    $bResult = true;
-
-    if (PEAR::isError($oResult)) {
-        echo "\nERROR: Failed to load nominatim module. Reason:\n";
-        echo $oResult->userinfo . "\n\n";
-        $bResult = false;
+    $sBinary = getSetting('OSM2PGSQL_BINARY');
+
+    return $sBinary ? $sBinary : CONST_Default_Osm2pgsql;
+}
+
+function getImportStyle()
+{
+    $sStyle = getSetting('IMPORT_STYLE');
+
+    if (in_array($sStyle, array('admin', 'street', 'address', 'full', 'extratags'))) {
+        return CONST_DataDir.'/settings/import-'.$sStyle.'.style';
     }
-    return $bResult;
+
+    return $sStyle;
 }