]> git.openstreetmap.org Git - nominatim.git/commitdiff
use postgis as an extension for versions >= 2.0
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 10 Oct 2013 21:10:18 +0000 (23:10 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 10 Oct 2013 21:13:58 +0000 (23:13 +0200)
utils/setup.php

index 0e1a1f4db676a0e08ed0bccdccc539e581851cef..fb16254dba4066acad970d3e93a763b75d598c2f 100755 (executable)
                        pgsqlRunScript('CREATE EXTENSION hstore');
                }
 
-               pgsqlRunScriptFile(CONST_Path_Postgresql_Postgis.'/postgis.sql');
+               $fPostgisVersion = (float) CONST_Postgis_Version;
+               if ($fPostgisVersion < 2.0) {
+                       pgsqlRunScriptFile(CONST_Path_Postgresql_Postgis.'/postgis.sql');
+                       pgsqlRunScriptFile(CONST_Path_Postgresql_Postgis.'/spatial_ref_sys.sql');
+               } else {
+                       pgsqlRunScript('CREATE EXTENSION postgis');
+               }
                $sVersionString = $oDB->getOne('select postgis_full_version()');
                preg_match('#POSTGIS="([0-9]+)[.]([0-9]+)[.]([0-9]+)( r([0-9]+))?"#', $sVersionString, $aMatches);
                if (CONST_Postgis_Version != $aMatches[1].'.'.$aMatches[2])
                        exit;
                }
 
-               pgsqlRunScriptFile(CONST_Path_Postgresql_Postgis.'/spatial_ref_sys.sql');
                pgsqlRunScriptFile(CONST_BasePath.'/data/country_name.sql');
                pgsqlRunScriptFile(CONST_BasePath.'/data/country_naturalearthdata.sql');
                pgsqlRunScriptFile(CONST_BasePath.'/data/country_osm_grid.sql');