exit(1);
}
$this->pgsqlRunScriptFile(CONST_BasePath.'/data/country_name.sql');
- $this->pgsqlRunScriptFile(CONST_BasePath.'/data/country_osm_grid.sql.gz');
+ $this->pgsqlRunScriptFile(CONST_ExtraDataPath.'/country_osm_grid.sql.gz');
$this->pgsqlRunScriptFile(CONST_BasePath.'/data/gb_postcode_table.sql');
$this->pgsqlRunScriptFile(CONST_BasePath.'/data/us_postcode_table.sql');
{
info('Import Tiger data');
+ $aFilenames = glob(CONST_Tiger_Data_Path.'/*.sql');
+ info('Found '.count($aFilenames).' SQL files in path '.CONST_Tiger_Data_Path);
+ if (empty($aFilenames)) return;
+
$sTemplate = file_get_contents(CONST_BasePath.'/sql/tiger_import_start.sql');
$sTemplate = str_replace('{www-user}', CONST_Database_Web_User, $sTemplate);
$sTemplate = $this->replaceTablespace(
pg_ping($aDBInstances[$i]);
}
- foreach (glob(CONST_Tiger_Data_Path.'/*.sql') as $sFile) {
+ foreach ($aFilenames as $sFile) {
echo $sFile.': ';
$hFile = fopen($sFile, 'r');
$sSQL = fgets($hFile, 100000);
}
foreach ($aDropTables as $sDrop) {
if ($this->bVerbose) echo "Dropping table $sDrop\n";
- $this->oDB->exec("DROP TABLE $sDrop CASCADE");
- // ignore warnings/errors as they might be caused by a table having
- // been deleted already by CASCADE
+ $this->oDB->exec("DROP TABLE IF EXISTS $sDrop CASCADE");
}
if (!is_null(CONST_Osm2pgsql_Flatnode_File) && CONST_Osm2pgsql_Flatnode_File) {