diff --git a/lib/lib.php b/lib/lib.php index aeba499b..74abe6a2 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -7,16 +7,16 @@ function loadSettings($sProjectDir) @define('CONST_InstallDir', $sProjectDir); $dotenv = new \Symfony\Component\Dotenv\Dotenv(); + $dotenv->load(CONST_DataDir.'/settings/env.defaults'); if (file_exists($sProjectDir.'/.env')) { $dotenv->load($sProjectDir.'/.env'); } - $dotenv->load(CONST_DataDir.'/settings/env.defaults'); } function getSetting($sConfName, $sDefault = null) { - $sValue = $_ENV['NOMINATIM_'.$sConfName]; + $sValue = $_SERVER['NOMINATIM_'.$sConfName]; if ($sDefault !== null && !$sValue) { return $sDefault; diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index 4e3d6ece..850ff297 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -287,7 +287,7 @@ class SetupFunctions public function importWikipediaArticles() { - $sWikiArticlePath = getSettings('WIKIPEDIA_DATA_PATH', CONST_DataDir.'/data'); + $sWikiArticlePath = getSetting('WIKIPEDIA_DATA_PATH', CONST_DataDir.'/data'); $sWikiArticlesFile = $sWikiArticlePath.'/wikimedia-importance.sql.gz'; if (file_exists($sWikiArticlesFile)) { info('Importing wikipedia articles and redirects'); @@ -723,12 +723,12 @@ class SetupFunctions @define('CONST_NoAccessControl', ".(getSettingBool('CORS_NOACCESSCONTROL') ? 'true' : 'false')."); @define('CONST_Places_Max_ID_count', ".getSetting('LOOKUP_MAX_COUNT')."); @define('CONST_PolygonOutput_MaximumTypes', ".getSetting('POLYGON_OUTPUT_MAX_TYPES')."); -@define('CONST_Search_BatchMode', ".(getSettingBool('SEARCH_BATCH_MODE' ? 'true' : 'false')."); +@define('CONST_Search_BatchMode', ".(getSettingBool('SEARCH_BATCH_MODE') ? 'true' : 'false')."); @define('CONST_Search_NameOnlySearchFrequencyThreshold', ".getSetting('SEARCH_NAME_ONLY_THRESHOLD')."); @define('CONST_Term_Normalization_Rules', \"".getSetting('TERM_NORMALIZATION')."\"); @define('CONST_Use_Aux_Location_data', ".(getSettingBool('USE_AUX_LOCATION_DATA') ? 'true' : 'false')."); @define('CONST_Use_US_Tiger_Data', ".(getSettingBool('USE_US_TIGER_DATA') ? 'true' : 'false')."); -@define('CONST_MapIcon_URL', ".(getSetting('MAPICON_URL', 'false').'); +@define('CONST_MapIcon_URL', ".getSetting('MAPICON_URL', 'false').'); '); info(CONST_InstallDir.'/settings/settings-frontend.php has been set up successfully'); } @@ -755,9 +755,8 @@ class SetupFunctions { $sFName = getSetting('FLATNODE_FILE'); if ($sFName && file_exists($sFName)) { - if ($this->bVerbose) echo 'Deleting '.$sFName."\n"; - unlink($sFName); - } + if ($this->bVerbose) echo 'Deleting '.$sFName."\n"; + unlink($sFName); } } diff --git a/settings/env.defaults b/settings/env.defaults index 0a7b60d1..fbad3e33 100644 --- a/settings/env.defaults +++ b/settings/env.defaults @@ -92,7 +92,7 @@ NOMINATIM_ADDRESS_LEVEL_CONFIG= # This may either be the name of one of an internal style or point # to a file with a custom style. # Internal styles are: admin, street, address, full, extratags -NOMNIATIM_IMPORT_STYLE=extratags +NOMINATIM_IMPORT_STYLE=extratags # Location of the flatnode file used by osm2pgsql to store node locations. # When unset, osm2pgsql stores the location in the PostgreSQL database. This diff --git a/utils/specialphrases.php b/utils/specialphrases.php index 8e8ea63c..b1df6436 100644 --- a/utils/specialphrases.php +++ b/utils/specialphrases.php @@ -25,9 +25,9 @@ if ($aCMDResult['wiki-import']) { $aPairs = array(); $sLanguageIn = getSetting( - LANGUAGES, + 'LANGUAGES', 'af,ar,br,ca,cs,de,en,es,et,eu,fa,fi,fr,gl,hr,hu,'. - 'ia,is,it,ja,mk,nl,no,pl,ps,pt,ru,sk,sl,sv,uk,vi'; + 'ia,is,it,ja,mk,nl,no,pl,ps,pt,ru,sk,sl,sv,uk,vi' ); foreach (explode(',', $sLanguageIn) as $sLanguage) { @@ -109,7 +109,10 @@ if ($aCMDResult['wiki-import']) { echo 'CREATE INDEX idx_placex_classtype ON placex (class, type);'; foreach ($aPairs as $aPair) { - $sql_tablespace = CONST_Tablespace_Aux_Data ? ' TABLESPACE '.CONST_Tablespace_Aux_Data : ''; + $sql_tablespace = getSetting('TABLESPACE_AUX_DATA'); + if ($sql_tablespace) { + $sql_tablespace = ' TABLESPACE '.$sql_tablespace; + } printf( 'CREATE TABLE place_classtype_%s_%s' @@ -151,7 +154,7 @@ if ($aCMDResult['wiki-import']) { . ";\n", pg_escape_string($aPair[0]), pg_escape_string($aPair[1]), - getSetting('DATABASE_WEBUSER'); + getSetting('DATABASE_WEBUSER') ); }