mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
Merge pull request #1372 from lonvia/raise-postgres-version
increase minimum versions for PostgreSQL, Postgis and PHP
This commit is contained in:
@@ -40,9 +40,9 @@ For running tests:
|
|||||||
|
|
||||||
For running Nominatim:
|
For running Nominatim:
|
||||||
|
|
||||||
* [PostgreSQL](http://www.postgresql.org) (9.1 or later)
|
* [PostgreSQL](http://www.postgresql.org) (9.3 or later)
|
||||||
* [PostGIS](http://postgis.refractions.net) (2.0 or later)
|
* [PostGIS](http://postgis.refractions.net) (2.2 or later)
|
||||||
* [PHP](http://php.net) (5.4 or later)
|
* [PHP](http://php.net) (7.0 or later)
|
||||||
* PHP-pgsql
|
* PHP-pgsql
|
||||||
* PHP-intl (bundled with PHP)
|
* PHP-intl (bundled with PHP)
|
||||||
* [PEAR::DB](http://pear.php.net/package/DB)
|
* [PEAR::DB](http://pear.php.net/package/DB)
|
||||||
|
|||||||
@@ -106,34 +106,19 @@ class SetupFunctions
|
|||||||
$fPostgresVersion = $this->oDB->getPostgresVersion();
|
$fPostgresVersion = $this->oDB->getPostgresVersion();
|
||||||
echo 'Postgres version found: '.$fPostgresVersion."\n";
|
echo 'Postgres version found: '.$fPostgresVersion."\n";
|
||||||
|
|
||||||
if ($fPostgresVersion < 9.01) {
|
if ($fPostgresVersion < 9.03) {
|
||||||
fail('Minimum supported version of Postgresql is 9.1.');
|
fail('Minimum supported version of Postgresql is 9.3.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pgsqlRunScript('CREATE EXTENSION IF NOT EXISTS hstore');
|
$this->pgsqlRunScript('CREATE EXTENSION IF NOT EXISTS hstore');
|
||||||
$this->pgsqlRunScript('CREATE EXTENSION IF NOT EXISTS postgis');
|
$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();
|
$fPostgisVersion = $this->oDB->getPostgisVersion();
|
||||||
echo 'Postgis version found: '.$fPostgisVersion."\n";
|
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) {
|
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."'");
|
$i = $this->oDB->getOne("select count(*) from pg_user where usename = '".CONST_Database_Web_User."'");
|
||||||
|
|||||||
Reference in New Issue
Block a user