// Try accessing the C module, so we know early if something is wrong
$this->checkModulePresence(); // raises exception on failure
- if (!file_exists(CONST_DataDir.'/data/country_osm_grid.sql.gz')) {
- echo 'Error: you need to download the country_osm_grid first:';
- echo "\n wget -O ".CONST_DataDir."/data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz\n";
- exit(1);
- }
- $this->pgsqlRunScriptFile(CONST_DataDir.'/data/country_name.sql');
- $this->pgsqlRunScriptFile(CONST_DataDir.'/data/country_osm_grid.sql.gz');
+ $this->pgsqlRunScriptFile(CONST_DataDir.'/country_name.sql');
+ $this->pgsqlRunScriptFile(CONST_DataDir.'/country_osm_grid.sql.gz');
if ($this->bNoPartitions) {
$this->pgsqlRunScript('update country_name set partition = 0');
{
info('Create Tables');
- $sTemplate = file_get_contents(CONST_DataDir.'/sql/tables.sql');
+ $sTemplate = file_get_contents(CONST_SqlDir.'/tables.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunScript($sTemplate, false);
{
info('Create Tables');
- $sTemplate = file_get_contents(CONST_DataDir.'/sql/table-triggers.sql');
+ $sTemplate = file_get_contents(CONST_SqlDir.'/table-triggers.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunScript($sTemplate, false);
{
info('Create Partition Tables');
- $sTemplate = file_get_contents(CONST_DataDir.'/sql/partition-tables.src.sql');
+ $sTemplate = file_get_contents(CONST_SqlDir.'/partition-tables.src.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunPartitionScript($sTemplate);
// pre-create the word list
if (!$bDisableTokenPrecalc) {
info('Loading word list');
- $this->pgsqlRunScriptFile(CONST_DataDir.'/data/words.sql');
+ $this->pgsqlRunScriptFile(CONST_DataDir.'/words.sql');
}
info('Load Data');
warn('Tiger data import selected but no files found in path '.$sTigerPath);
return;
}
- $sTemplate = file_get_contents(CONST_DataDir.'/sql/tiger_import_start.sql');
+ $sTemplate = file_get_contents(CONST_SqlDir.'/tiger_import_start.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunScript($sTemplate, false);
}
info('Creating indexes on Tiger data');
- $sTemplate = file_get_contents(CONST_DataDir.'/sql/tiger_import_finish.sql');
+ $sTemplate = file_get_contents(CONST_SqlDir.'/tiger_import_finish.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunScript($sTemplate, false);
public function calculatePostcodes($bCMDResultAll)
{
info('Calculate Postcodes');
- $this->pgsqlRunScriptFile(CONST_DataDir.'/sql/postcode_tables.sql');
+ $this->pgsqlRunScriptFile(CONST_SqlDir.'/postcode_tables.sql');
$sPostcodeFilename = CONST_InstallDir.'/gb_postcode_data.sql.gz';
if (file_exists($sPostcodeFilename)) {
$this->db()->exec("DROP INDEX $sIndexName;");
}
- $sTemplate = file_get_contents(CONST_DataDir.'/sql/indices.src.sql');
+ $sTemplate = file_get_contents(CONST_SqlDir.'/indices.src.sql');
if (!$this->bDrop) {
- $sTemplate .= file_get_contents(CONST_DataDir.'/sql/indices_updates.src.sql');
+ $sTemplate .= file_get_contents(CONST_SqlDir.'/indices_updates.src.sql');
}
if (!$this->dbReverseOnly()) {
- $sTemplate .= file_get_contents(CONST_DataDir.'/sql/indices_search.src.sql');
+ $sTemplate .= file_get_contents(CONST_SqlDir.'/indices_search.src.sql');
}
$sTemplate = $this->replaceSqlPatterns($sTemplate);
fwrite($rFile, '@define(\'CONST_Debug\', $_GET[\'debug\'] ?? false);'."\n\n");
fwriteConstDef($rFile, 'LibDir', CONST_LibDir);
- fwriteConstDef($rFile, 'DataDir', CONST_DataDir);
- fwriteConstDef($rFile, 'InstallDir', CONST_InstallDir);
fwriteConstDef($rFile, 'Database_DSN', getSetting('DATABASE_DSN'));
fwriteConstDef($rFile, 'Default_Language', getSetting('DEFAULT_LANGUAGE'));
fwriteConstDef($rFile, 'Log_DB', getSettingBool('LOG_DB'));