X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/5864fddb537a845e0281a433f00413dde9d70a08..5d160ec514af97af2f430bbe9b02360ae4f0767c:/utils/setup.php diff --git a/utils/setup.php b/utils/setup.php index edf0b14d..e588bb08 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -22,6 +22,7 @@ array('create-functions', '', 0, 1, 0, 0, 'bool', 'Create functions'), array('enable-diff-updates', '', 0, 1, 0, 0, 'bool', 'Turn on the code required to make diff updates work'), array('enable-debug-statements', '', 0, 1, 0, 0, 'bool', 'Include debug warning statements in pgsql commands'), + array('ignore-errors', '', 0, 1, 0, 0, 'bool', 'Continue import even when errors in SQL are present (EXPERT)'), array('create-minimal-tables', '', 0, 1, 0, 0, 'bool', 'Create minimal main tables'), array('create-tables', '', 0, 1, 0, 0, 'bool', 'Create main tables'), array('create-partition-tables', '', 0, 1, 0, 0, 'bool', 'Create required partition tables'), @@ -191,7 +192,7 @@ } $osm2pgsql .= ' --tablespace-slim-index ssd --tablespace-main-index ssd --tablespace-main-data ssd --tablespace-slim-data data'; $osm2pgsql .= ' -lsc -O gazetteer --hstore'; - $osm2pgsql .= ' -C 18000'; + $osm2pgsql .= ' -C 25000'; $osm2pgsql .= ' -P '.$aDSNInfo['port']; $osm2pgsql .= ' -d '.$aDSNInfo['database'].' '.$aCMDResult['osm-file']; passthruCheckReturn($osm2pgsql); @@ -746,11 +747,13 @@ function pgsqlRunScript($sScript) { + global $aCMDResult; // Convert database DSN to psql parameters $aDSNInfo = DB::parseDSN(CONST_Database_DSN); if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432; $sCMD = 'psql -p '.$aDSNInfo['port'].' -d '.$aDSNInfo['database']; - $sCMD .= ' -v ON_ERROR_STOP=1'; + if (!$aCMDResult['ignore-errors']) + $sCMD .= ' -v ON_ERROR_STOP=1'; $aDescriptors = array( 0 => array('pipe', 'r'), 1 => STDOUT, @@ -763,6 +766,7 @@ while(strlen($sScript)) { $written = fwrite($ahPipes[0], $sScript); + if ($written <= 0) break; $sScript = substr($sScript, $written); } fclose($ahPipes[0]); @@ -799,10 +803,6 @@ fclose($ahPipes[1]); $iReturn = proc_close($hProcess); - if ($iReturn > 0) - { - fail("pgsql returned with error code ($iReturn)"); - } } function pgsqlRunDropAndRestore($sDumpFile) @@ -831,10 +831,6 @@ fclose($ahPipes[1]); $iReturn = proc_close($hProcess); - if ($iReturn > 0) - { - fail("pgsql returned with error code ($iReturn)"); - } } function passthruCheckReturn($cmd)