From c05ddb61194f4773f81b53d28e6512dfb9d5a6ac Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 2 May 2019 21:48:40 +0200 Subject: [PATCH] increase minimum versions for PostgreSQL, Postgis and PHP Remove checks and hacks for older versions. --- docs/admin/Installation.md | 6 +++--- lib/setup/SetupClass.php | 23 ++++------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/docs/admin/Installation.md b/docs/admin/Installation.md index 592c6cc1..7ce1ea67 100644 --- a/docs/admin/Installation.md +++ b/docs/admin/Installation.md @@ -40,9 +40,9 @@ For running tests: For running Nominatim: - * [PostgreSQL](http://www.postgresql.org) (9.1 or later) - * [PostGIS](http://postgis.refractions.net) (2.0 or later) - * [PHP](http://php.net) (5.4 or later) + * [PostgreSQL](http://www.postgresql.org) (9.3 or later) + * [PostGIS](http://postgis.refractions.net) (2.2 or later) + * [PHP](http://php.net) (7.0 or later) * PHP-pgsql * PHP-intl (bundled with PHP) * [PEAR::DB](http://pear.php.net/package/DB) diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index d3f59296..1447e383 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -106,34 +106,19 @@ class SetupFunctions $fPostgresVersion = $this->oDB->getPostgresVersion(); echo 'Postgres version found: '.$fPostgresVersion."\n"; - if ($fPostgresVersion < 9.01) { - fail('Minimum supported version of Postgresql is 9.1.'); + if ($fPostgresVersion < 9.03) { + fail('Minimum supported version of Postgresql is 9.3.'); } $this->pgsqlRunScript('CREATE EXTENSION IF NOT EXISTS hstore'); $this->pgsqlRunScript('CREATE EXTENSION IF NOT EXISTS postgis'); - // For extratags and namedetails the hstore_to_json converter is - // needed which is only available from Postgresql 9.3+. For older - // versions add a dummy function that returns nothing. - $iNumFunc = $this->oDB->getOne("select count(*) from pg_proc where proname = 'hstore_to_json'"); - - if ($iNumFunc == 0) { - $this->pgsqlRunScript("create function hstore_to_json(dummy hstore) returns text AS 'select null::text' language sql immutable"); - warn('Postgresql is too old. extratags and namedetails API not available.'); - } - - $fPostgisVersion = $this->oDB->getPostgisVersion(); echo 'Postgis version found: '.$fPostgisVersion."\n"; - if ($fPostgisVersion < 2.1) { - // Functions were renamed in 2.1 and throw an annoying deprecation warning - $this->pgsqlRunScript('ALTER FUNCTION st_line_interpolate_point(geometry, double precision) RENAME TO ST_LineInterpolatePoint'); - $this->pgsqlRunScript('ALTER FUNCTION ST_Line_Locate_Point(geometry, geometry) RENAME TO ST_LineLocatePoint'); - } if ($fPostgisVersion < 2.2) { - $this->pgsqlRunScript('ALTER FUNCTION ST_Distance_Spheroid(geometry, geometry, spheroid) RENAME TO ST_DistanceSpheroid'); + echo "Minimum required Postgis version 2.2\n"; + exit(1); } $i = $this->oDB->getOne("select count(*) from pg_user where usename = '".CONST_Database_Web_User."'"); -- 2.39.5