]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #1864 from lonvia/langauge-specific-presuffixes
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 5 Jul 2020 08:54:42 +0000 (10:54 +0200)
committerGitHub <noreply@github.com>
Sun, 5 Jul 2020 08:54:42 +0000 (10:54 +0200)
exclude language-specific name:prefix and name:suffix

.travis.yml
cmake/website.tmpl
docs/admin/Import.md
docs/admin/Migration.md
lib/setup/SetupClass.php
utils/setup.php

index 08aa9eb48ab46c164ee58011a763a6e686b2d217..4461add9f454f8150f5ea5ffebdb5e937d3405eb 100644 (file)
@@ -26,6 +26,8 @@ script:
   - if [[ $TEST_SUITE == "tests" ]]; then phpcs --report-width=120 . ; fi
   - cd $TRAVIS_BUILD_DIR/test/php
   - if [[ $TEST_SUITE == "tests" ]]; then /usr/bin/phpunit ./ ; fi
+  - cd $TRAVIS_BUILD_DIR/build
+  - /usr/bin/env php ./utils/setup.php --setup-website
   - cd $TRAVIS_BUILD_DIR/test/bdd
   - # behave --format=progress3 api
   - if [[ $TEST_SUITE == "tests" ]]; then behave -DREMOVE_TEMPLATE=1 --format=progress3 db ; fi
index 0257aa10e46bcba4fc95f1eae85f17d0ecfa4993..8692280d41a4026f55095d0772c9de301e771696 100755 (executable)
@@ -1,3 +1,3 @@
 <?php
-require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
+require_once(dirname(dirname(__FILE__)).'/website/settings-frontend.php');
 require_once(CONST_BasePath.'/@script_source@');
index bcc33af81e05aee601d8fb88144151f9488c7b04..b3b5448c83d864e60ba01e2fd4f71b88858f9037 100644 (file)
@@ -195,6 +195,17 @@ Run this script to verify all required tables and indices got created successful
 ./utils/check_import_finished.php
 ```
 
+### Setting up the website
+
+Run the following command to set up the `website/settings-frontend.php`.
+These settings are used in website/*.php files. You can use the website only after this 
+step is completed.
+
+```sh
+./utils/setup.php --setup-website
+```
+!!! Note
+    This step is not necessary if you use `--all` option while setting up the DB.
 
 ## Tuning the database
 
index f3858cf6963ff0b1bfbc244359b83e18cf3e7818..c7d3fe18807d856a764130e58ad0dad22d97579d 100644 (file)
@@ -21,6 +21,18 @@ follows:
 
 The last step takes about 10 hours on the full planet.
 
+Remove one function (it will be recreated in the next step):
+
+```sql
+DROP FUNCTION create_country(hstore,character varying);
+```
+
+Finally, update all SQL functions:
+
+```sh
+./utils/setup.php --create-functions --enable-diff-updates --create-partition-functions
+```
+
 ## 3.3.0 -> 3.4.0
 
 ### Reorganisation of location_area_country table
@@ -38,6 +50,12 @@ CREATE INDEX idx_location_area_country_geometry ON location_area_country USING G
 CREATE INDEX idx_location_area_country_place_id ON location_area_country USING BTREE (place_id);
 ```
 
+Finally, update all SQL functions:
+
+```sh
+./utils/setup.php --create-functions --enable-diff-updates --create-partition-functions
+```
+
 ## 3.2.0 -> 3.3.0
 
 ### New database connection string (DSN) format
index 385eff70eb6cda7160cb84f7a6b5c5ff0c96b08e..16c4872982a0413d039c205153164a6510287ab7 100755 (executable)
@@ -694,6 +694,45 @@ class SetupFunctions
         $this->removeFlatnodeFile();
     }
 
+    /**
+     * Setup settings-frontend.php in the build/website directory
+     *
+     * @return null
+     */
+    public function setupWebsite()
+    {
+        $rOutputFile = fopen(CONST_InstallPath.'/website/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_Debug', ". (CONST_Debug? 'true' : 'false').");
+@define('CONST_Database_DSN', '".CONST_Database_DSN."'); // or add ;host=...;port=...;user=...;password=...
+@define('CONST_Default_Language', ".(CONST_Default_Language ? 'true' : '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 ? 'true' : 'false').");
+@define('CONST_Max_Word_Frequency', '".CONST_Max_Word_Frequency."');
+@define('CONST_NoAccessControl', ".CONST_NoAccessControl.");
+@define('CONST_Places_Max_ID_count', ".CONST_Places_Max_ID_count.");
+@define('CONST_PolygonOutput_MaximumTypes', ".CONST_PolygonOutput_MaximumTypes.");
+@define('CONST_Search_AreaPolygons', ".CONST_Search_AreaPolygons.");
+@define('CONST_Search_BatchMode', ".(CONST_Search_BatchMode ? 'true' : 'false').");
+@define('CONST_Search_NameOnlySearchFrequencyThreshold', ".CONST_Search_NameOnlySearchFrequencyThreshold.");
+@define('CONST_Search_ReversePlanForAll', ".CONST_Search_ReversePlanForAll.");
+@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.'/website/settings-frontend.php has been set up successfully');
+    }
+
     private function removeFlatnodeFile()
     {
         if (!is_null(CONST_Osm2pgsql_Flatnode_File) && CONST_Osm2pgsql_Flatnode_File) {
index 3015f13a45e7dd5d2befb7fdb88df60973b2e0bd..e0f74427cb46b69c8dfe6e08ffe029e62fe76ad6 100644 (file)
@@ -44,6 +44,7 @@ $aCMDOptions
    array('create-search-indices', '', 0, 1, 0, 0, 'bool', 'Create additional indices required for search and update'),
    array('create-country-names', '', 0, 1, 0, 0, 'bool', 'Create default list of searchable country names'),
    array('drop', '', 0, 1, 0, 0, 'bool', 'Drop tables needed for updates, making the database readonly (EXPERIMENTAL)'),
+   array('setup-website', '', 0, 1, 0, 0, 'bool', 'Used to compile environment variables for the website (EXPERIMENTAL)'),
   );
 
 // $aCMDOptions passed to getCmdOpt by reference
@@ -76,15 +77,17 @@ if ($aCMDResult['create-db'] || $aCMDResult['all']) {
     $oSetup->createDB();
 }
 
-$oSetup->connect();
+if (!$aCMDResult['setup-website']) {
+    $oSetup->connect();
+    // Try accessing the C module, so we know early if something is wrong
+    checkModulePresence(); // raises exception on failure
+}
 
 if ($aCMDResult['setup-db'] || $aCMDResult['all']) {
     $bDidSomething = true;
     $oSetup->setupDB();
 }
 
-// Try accessing the C module, so we know early if something is wrong
-checkModulePresence(); // raises exception on failure
 
 if ($aCMDResult['import-data'] || $aCMDResult['all']) {
     $bDidSomething = true;
@@ -153,6 +156,11 @@ if ($aCMDResult['create-country-names'] || $aCMDResult['all']) {
     $oSetup->createCountryNames($aCMDResult);
 }
 
+if ($aCMDResult['setup-website'] || $aCMDResult['all']) {
+    $bDidSomething = true;
+    $oSetup->setupWebsite();
+}
+
 // ******************************************************
 // If we did something, repeat the warnings
 if (!$bDidSomething) {