X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6cc06828dbc722deb1c06dc4176400f727eb24dc..a759c5b75b66894b1902327097185840a2557f86:/lib/setup/SetupClass.php diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index dda49160..2a498287 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -173,22 +173,6 @@ class SetupFunctions } $this->pgsqlRunScriptFile(CONST_DataDir.'/data/country_name.sql'); $this->pgsqlRunScriptFile(CONST_DataDir.'/data/country_osm_grid.sql.gz'); - $this->pgsqlRunScriptFile(CONST_DataDir.'/data/gb_postcode_table.sql'); - $this->pgsqlRunScriptFile(CONST_DataDir.'/data/us_postcode_table.sql'); - - $sPostcodeFilename = CONST_InstallDir.'/gb_postcode_data.sql.gz'; - if (file_exists($sPostcodeFilename)) { - $this->pgsqlRunScriptFile($sPostcodeFilename); - } else { - warn('optional external GB postcode table file ('.$sPostcodeFilename.') not found. Skipping.'); - } - - $sPostcodeFilename = CONST_InstallDir.'/us_postcode_data.sql.gz'; - if (file_exists($sPostcodeFilename)) { - $this->pgsqlRunScriptFile($sPostcodeFilename); - } else { - warn('optional external US postcode table file ('.$sPostcodeFilename.') not found. Skipping.'); - } if ($this->bNoPartitions) { $this->pgsqlRunScript('update country_name set partition = 0'); @@ -521,6 +505,23 @@ class SetupFunctions public function calculatePostcodes($bCMDResultAll) { info('Calculate Postcodes'); + $this->pgsqlRunScriptFile(CONST_DataDir.'/sql/postcode_tables.sql'); + + $sPostcodeFilename = CONST_InstallDir.'/gb_postcode_data.sql.gz'; + if (file_exists($sPostcodeFilename)) { + $this->pgsqlRunScriptFile($sPostcodeFilename); + } else { + warn('optional external GB postcode table file ('.$sPostcodeFilename.') not found. Skipping.'); + } + + $sPostcodeFilename = CONST_InstallDir.'/us_postcode_data.sql.gz'; + if (file_exists($sPostcodeFilename)) { + $this->pgsqlRunScriptFile($sPostcodeFilename); + } else { + warn('optional external US postcode table file ('.$sPostcodeFilename.') not found. Skipping.'); + } + + $this->db()->exec('TRUNCATE location_postcode'); $sSQL = 'INSERT INTO location_postcode'; @@ -753,8 +754,7 @@ class SetupFunctions fwriteConstDef($rFile, 'Use_US_Tiger_Data', getSettingBool('USE_US_TIGER_DATA')); fwriteConstDef($rFile, 'MapIcon_URL', getSetting('MAPICON_URL')); - // XXX scripts should go into the library. - fwrite($rFile, 'require_once(\''.CONST_DataDir.'/website/'.$sScript."');\n"); + fwrite($rFile, 'require_once(\''.CONST_LibDir.'/website/'.$sScript."');\n"); fclose($rFile); chmod(CONST_InstallDir.'/website/'.$sScript, 0755);