namespace Nominatim\Setup;
-require_once(CONST_BasePath.'/lib/setup/AddressLevelParser.php');
-require_once(CONST_BasePath.'/lib/Shell.php');
+require_once(CONST_LibDir.'/setup/AddressLevelParser.php');
+require_once(CONST_LibDir.'/Shell.php');
class SetupFunctions
{
// Try accessing the C module, so we know early if something is wrong
checkModulePresence(); // raises exception on failure
- if (!file_exists(CONST_ExtraDataPath.'/country_osm_grid.sql.gz')) {
+ 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_ExtraDataPath."/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz\n";
+ 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_BasePath.'/data/country_name.sql');
- $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');
+ $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_BasePath.'/data/gb_postcode_data.sql.gz';
+ $sPostcodeFilename = CONST_DataDir.'/data/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_BasePath.'/data/us_postcode_data.sql.gz';
+ $sPostcodeFilename = CONST_DataDir.'/data/us_postcode_data.sql.gz';
if (file_exists($sPostcodeFilename)) {
$this->pgsqlRunScriptFile($sPostcodeFilename);
} else {
$oCmd->addParams('--output', 'gazetteer');
$oCmd->addParams('--hstore');
$oCmd->addParams('--number-processes', 1);
+ $oCmd->addParams('--with-forward-dependencies', 'false');
+ $oCmd->addParams('--log-progress', 'true');
$oCmd->addParams('--cache', $this->iCacheMemory);
$oCmd->addParams('--port', $this->aDSNInfo['port']);
{
info('Create Tables');
- $sTemplate = file_get_contents(CONST_BasePath.'/sql/tables.sql');
+ $sTemplate = file_get_contents(CONST_DataDir.'/sql/tables.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunScript($sTemplate, false);
{
info('Create Tables');
- $sTemplate = file_get_contents(CONST_BasePath.'/sql/table-triggers.sql');
+ $sTemplate = file_get_contents(CONST_DataDir.'/sql/table-triggers.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunScript($sTemplate, false);
{
info('Create Partition Tables');
- $sTemplate = file_get_contents(CONST_BasePath.'/sql/partition-tables.src.sql');
+ $sTemplate = file_get_contents(CONST_DataDir.'/sql/partition-tables.src.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunPartitionScript($sTemplate);
{
info('Create Partition Functions');
- $sTemplate = file_get_contents(CONST_BasePath.'/sql/partition-functions.src.sql');
+ $sTemplate = file_get_contents(CONST_DataDir.'/sql/partition-functions.src.sql');
$this->pgsqlRunPartitionScript($sTemplate);
}
// pre-create the word list
if (!$bDisableTokenPrecalc) {
info('Loading word list');
- $this->pgsqlRunScriptFile(CONST_BasePath.'/data/words.sql');
+ $this->pgsqlRunScriptFile(CONST_DataDir.'/data/words.sql');
}
info('Load Data');
warn('Tiger data import selected but no files found in path '.CONST_Tiger_Data_Path);
return;
}
- $sTemplate = file_get_contents(CONST_BasePath.'/sql/tiger_import_start.sql');
+ $sTemplate = file_get_contents(CONST_DataDir.'/sql/tiger_import_start.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunScript($sTemplate, false);
}
info('Creating indexes on Tiger data');
- $sTemplate = file_get_contents(CONST_BasePath.'/sql/tiger_import_finish.sql');
+ $sTemplate = file_get_contents(CONST_DataDir.'/sql/tiger_import_finish.sql');
$sTemplate = $this->replaceSqlPatterns($sTemplate);
$this->pgsqlRunScript($sTemplate, false);
{
checkModulePresence(); // raises exception on failure
- $oBaseCmd = (new \Nominatim\Shell(CONST_BasePath.'/nominatim/nominatim.py'))
+ $oBaseCmd = (new \Nominatim\Shell(CONST_DataDir.'/nominatim/nominatim.py'))
->addParams('--database', $this->aDSNInfo['database'])
->addParams('--port', $this->aDSNInfo['port'])
->addParams('--threads', $this->iInstances);
$this->db()->exec("DROP INDEX $sIndexName;");
}
- $sTemplate = file_get_contents(CONST_BasePath.'/sql/indices.src.sql');
+ $sTemplate = file_get_contents(CONST_DataDir.'/sql/indices.src.sql');
if (!$this->bDrop) {
- $sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_updates.src.sql');
+ $sTemplate .= file_get_contents(CONST_DataDir.'/sql/indices_updates.src.sql');
}
if (!$this->dbReverseOnly()) {
- $sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_search.src.sql');
+ $sTemplate .= file_get_contents(CONST_DataDir.'/sql/indices_search.src.sql');
}
$sTemplate = $this->replaceSqlPatterns($sTemplate);
*/
public function setupWebsite()
{
- $rOutputFile = fopen(CONST_InstallPath.'/settings/settings-frontend.php', 'w');
+ $rOutputFile = fopen(CONST_InstallDir.'/settings/settings-frontend.php', 'w');
fwrite($rOutputFile, "<?php
-@define('CONST_BasePath', '".CONST_BasePath."');
if (file_exists(getenv('NOMINATIM_SETTINGS'))) require_once(getenv('NOMINATIM_SETTINGS'));
-@define('CONST_Database_DSN', '".CONST_Database_DSN."'); // or add ;host=...;port=...;user=...;password=...
+@define('CONST_Database_DSN', '".CONST_Database_DSN."');
@define('CONST_Default_Language', ".(CONST_Default_Language ? ("'".CONST_Default_Language."'") : 'false').");
-@define('CONST_Default_Lat', ".CONST_Default_Lat.");
-@define('CONST_Default_Lon', ".CONST_Default_Lon.");
-@define('CONST_Default_Zoom', ".CONST_Default_Zoom.");
-@define('CONST_Map_Tile_URL', '".CONST_Map_Tile_URL."');
-@define('CONST_Map_Tile_Attribution', '".CONST_Map_Tile_Attribution."'); // Set if tile source isn't osm.org
@define('CONST_Log_DB', ".(CONST_Log_DB ? 'true' : 'false').");
@define('CONST_Log_File', ".(CONST_Log_File ? ("'".CONST_Log_File."'") : 'false').");
@define('CONST_Max_Word_Frequency', '".CONST_Max_Word_Frequency."');
@define('CONST_Term_Normalization_Rules', \"".CONST_Term_Normalization_Rules."\");
@define('CONST_Use_Aux_Location_data', ".(CONST_Use_Aux_Location_data ? 'true' : 'false').");
@define('CONST_Use_US_Tiger_Data', ".(CONST_Use_US_Tiger_Data ? 'true' : 'false').");
-@define('CONST_Website_BaseURL', '".CONST_Website_BaseURL."');
-");
- info(CONST_InstallPath.'/settings/settings-frontend.php has been set up successfully');
+@define('CONST_MapIcon_URL', ".(CONST_MapIcon_URL ? ("'".CONST_MapIcon_URL."'") : 'false').');
+');
+ info(CONST_InstallDir.'/settings/settings-frontend.php has been set up successfully');
}
/**
private function createSqlFunctions()
{
- $sBasePath = CONST_BasePath.'/sql/functions/';
+ $sBasePath = CONST_DataDir.'/sql/functions/';
$sTemplate = file_get_contents($sBasePath.'utils.sql');
$sTemplate .= file_get_contents($sBasePath.'normalization.sql');
$sTemplate .= file_get_contents($sBasePath.'ranking.sql');