From 8675a2607a289ad1a027422730bc65982fe5221f Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 10 Oct 2013 23:10:18 +0200 Subject: [PATCH] use postgis as an extension for versions >= 2.0 --- utils/setup.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utils/setup.php b/utils/setup.php index 0e1a1f4d..fb16254d 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -125,7 +125,13 @@ 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]) @@ -134,7 +140,6 @@ 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');