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     // Raises Nominatim\DatabaseError on failure
 
  23     $sModulePath = CONST_Database_Module_Path;
 
  24     $sSQL = "CREATE FUNCTION nominatim_test_import_func(text) RETURNS text AS '";
 
  25     $sSQL .= $sModulePath . "/nominatim.so', 'transliteration' LANGUAGE c IMMUTABLE STRICT";
 
  26     $sSQL .= ';DROP FUNCTION nominatim_test_import_func(text);';
 
  28     $oDB = new \Nominatim\DB();
 
  30     $oDB->exec($sSQL, null, 'Database server failed to load '.$sModulePath.'/nominatim.so module');