]> git.openstreetmap.org Git - nominatim.git/blobdiff - utils/setup.php
Merge remote-tracking branch 'mtmail/mobile-responsive'
[nominatim.git] / utils / setup.php
index 97a9f301be55b94a7368724cdd4da461fa71c9df..eff7b71b447fef7fd36bab87e3db8569fef84231 100755 (executable)
@@ -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);
 
                        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
                }
        }
 
-       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.
                   "query_log",
                   "new_query_log",
                   "gb_postcode",
-                  "spatial_ref_sys"
+                  "spatial_ref_sys",
+                  "country_name",
+                  "place_classtype_*"
                );
 
                $oDB =& getDB();