3 function checkInFile($sOSMFile)
 
   5     if (!isset($sOSMFile)) {
 
   6         fail('missing --osm-file for data import');
 
   9     if (!file_exists($sOSMFile)) {
 
  10         fail('the path supplied to --osm-file does not exist');
 
  13     if (!is_readable($sOSMFile)) {
 
  14         fail('osm-file "' . $aCMDResult['osm-file'] . '" not readable');
 
  18 function checkModulePresence()
 
  20     // Try accessing the C module, so we know early if something is wrong
 
  21     // and can simply error out.
 
  22     $sModulePath = CONST_Database_Module_Path;
 
  23     $sSQL = "CREATE FUNCTION nominatim_test_import_func(text) RETURNS text AS '";
 
  24     $sSQL .= $sModulePath . "/nominatim.so', 'transliteration' LANGUAGE c IMMUTABLE STRICT";
 
  25     $sSQL .= ';DROP FUNCTION nominatim_test_import_func(text);';
 
  27     $oDB = new \Nominatim\DB();
 
  33     } catch (\Nominatim\DatabaseError $e) {
 
  34         echo "\nERROR: Failed to load nominatim module. Reason:\n";
 
  35         echo $oDB->getLastError()[2] . "\n\n";