]> git.openstreetmap.org Git - nominatim.git/commitdiff
use explicit DSN for website scripts
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 15 Dec 2020 14:36:13 +0000 (15:36 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sat, 19 Dec 2020 13:33:04 +0000 (14:33 +0100)
Website scripts have no access to the dotenv variables, so use
the DSN constant instead when connecting to the database.

website/deletable.php
website/details.php
website/lookup.php
website/polygons.php
website/reverse.php
website/search.php
website/status.php

index 9a0ea0d859a9a7927e343a09aafbaceffca68cc7..81fb4f99d35eeefb13ef16bd19f25708f1de0ad3 100644 (file)
@@ -9,7 +9,7 @@ $oParams = new Nominatim\ParameterParser();
 $sOutputFormat = $oParams->getSet('format', array('json'), 'json');
 set_exception_handler_by_format($sOutputFormat);
 
-$oDB = new Nominatim\DB();
+$oDB = new Nominatim\DB(CONST_Database_DSN);
 $oDB->connect();
 
 $sSQL = 'select placex.place_id, country_code,';
index 2f91b2bb4de2b9aa81b2f0e21dc0668285dc283f..91440b542a863c0c294337c174af54c9678bc115 100644 (file)
@@ -25,7 +25,7 @@ $bIncludeHierarchy = $oParams->getBool('hierarchy', false);
 $bGroupHierarchy = $oParams->getBool('group_hierarchy', false);
 $bIncludePolygonAsGeoJSON = $oParams->getBool('polygon_geojson', false);
 
-$oDB = new Nominatim\DB();
+$oDB = new Nominatim\DB(CONST_Database_DSN);
 $oDB->connect();
 
 $sLanguagePrefArraySQL = $oDB->getArraySQL($oDB->getDBQuotedList($aLangPrefOrder));
index e4a98939b93bf4b2ca0acfd810966061da1f8de2..737edc62985d6c795a755f40c0b7b6501efd7306 100644 (file)
@@ -15,7 +15,7 @@ set_exception_handler_by_format($sOutputFormat);
 // Preferred language
 $aLangPrefOrder = $oParams->getPreferredLanguages();
 
-$oDB = new Nominatim\DB();
+$oDB = new Nominatim\DB(CONST_Database_DSN);
 $oDB->connect();
 
 $hLog = logStart($oDB, 'place', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
index 418bec09b4ce09ed1a3cea6214109c52423ec4d7..88b48ae8e4c22c6d915a76df3299f9fbd3c162e6 100644 (file)
@@ -13,7 +13,7 @@ $iDays = $oParams->getInt('days', false);
 $bReduced = $oParams->getBool('reduced', false);
 $sClass = $oParams->getString('class', false);
 
-$oDB = new Nominatim\DB();
+$oDB = new Nominatim\DB(CONST_Database_DSN);
 $oDB->connect();
 
 $iTotalBroken = (int) $oDB->getOne('SELECT count(*) FROM import_polygon_error');
index 556808c1d649881123cd0564f9c08ecea591f85e..553c2692381a2161505388ab103ccc0d74f5d79c 100644 (file)
@@ -16,7 +16,7 @@ set_exception_handler_by_format($sOutputFormat);
 // Preferred language
 $aLangPrefOrder = $oParams->getPreferredLanguages();
 
-$oDB = new Nominatim\DB();
+$oDB = new Nominatim\DB(CONST_Database_DSN);
 $oDB->connect();
 
 $hLog = logStart($oDB, 'reverse', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
index 05d0e444e52130d7a02750d1272213db65c29d71..486468431e003741eb3668c1fa234343661b6159 100644 (file)
@@ -6,7 +6,7 @@ require_once(CONST_LibDir.'/Geocode.php');
 require_once(CONST_LibDir.'/output.php');
 ini_set('memory_limit', '200M');
 
-$oDB = new Nominatim\DB();
+$oDB = new Nominatim\DB(CONST_Database_DSN);
 $oDB->connect();
 $oParams = new Nominatim\ParameterParser();
 
index dc497ff5668bc84202327b925091b838ceb776d8..9f030fb3ea38314047b50973bc6929aa80117de3 100644 (file)
@@ -7,7 +7,7 @@ require_once(CONST_LibDir.'/Status.php');
 $oParams = new Nominatim\ParameterParser();
 $sOutputFormat = $oParams->getSet('format', array('text', 'json'), 'text');
 
-$oDB = new Nominatim\DB();
+$oDB = new Nominatim\DB(CONST_Database_DSN);
 
 if ($sOutputFormat == 'json') {
     header('content-type: application/json; charset=UTF-8');