X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/b5c984544854ab1af5826b93d79290d9f4b90e60..70997a9554262c8559731b55f0e300b2de9eed14:/utils/setup.php?ds=sidebyside diff --git a/utils/setup.php b/utils/setup.php index 97a9f301..54526f7e 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -39,7 +39,7 @@ array('index-output', '', 0, 1, 1, 1, 'string', 'File to dump index information to'), array('create-search-indices', '', 0, 1, 0, 0, 'bool', 'Create additional indices required for search and update'), array('create-website', '', 0, 1, 1, 1, 'realpath', 'Create symlinks to setup web directory'), - array('drop', '', 0, 1, 0, 0, 'bool', 'Drop tables needed for updates, making the database readonly'), + array('drop', '', 0, 1, 0, 0, 'bool', 'Drop tables needed for updates, making the database readonly (EXPERIMENTAL)'), ); getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true); @@ -97,7 +97,7 @@ { echo "Create DB\n"; $bDidSomething = true; - $oDB =& DB::connect(CONST_Database_DSN, false); + $oDB = DB::connect(CONST_Database_DSN, false); if (!PEAR::isError($oDB)) { fail('database already exists ('.CONST_Database_DSN.')'); @@ -134,7 +134,7 @@ pgsqlRunScriptFile(CONST_Path_Postgresql_Postgis.'/postgis.sql'); pgsqlRunScriptFile(CONST_Path_Postgresql_Postgis.'/spatial_ref_sys.sql'); } else { - pgsqlRunScript('CREATE EXTENSION postgis'); + pgsqlRunScript('CREATE EXTENSION IF NOT EXISTS postgis'); } if ($fPostgisVersion < 2.1) { // Function was renamed in 2.1 and throws an annoying deprecation warning @@ -722,7 +722,7 @@ @symlink(CONST_BasePath.'/website/css', $sTargetDir.'/css'); echo "Symlinks created\n"; - $sTestFile = @file_get_contents(CONST_Website_BaseURL.'js/tiles.js'); + $sTestFile = @file_get_contents(CONST_Website_BaseURL.'js/nominatim-ui.js'); if (!$sTestFile) { echo "\nWARNING: Unable to access the website at ".CONST_Website_BaseURL."\n"; @@ -730,8 +730,12 @@ } } - if (isset($aCMDResult['drop'])) + if ($aCMDResult['drop']) { + // The implementation is potentially a bit dangerous because it uses + // a positive selection of tables to keep, and deletes everything else. + // Including any tables that the unsuspecting user might have manually + // created. USE AT YOUR OWN PERIL. $bDidSomething = true; // tables we want to keep. everything else goes. @@ -748,7 +752,9 @@ "query_log", "new_query_log", "gb_postcode", - "spatial_ref_sys" + "spatial_ref_sys", + "country_name", + "place_classtype_*" ); $oDB =& getDB();