mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-15 19:07:58 +00:00
CONST_BasePath is split into separate configuration variables for binaries, libraries and data. These variables as well as the installation path are now set in the executable directly and no longer configurable via project settings. This is the first step towards an installable software. The executables should know per installation where to find their necessary data to execute. Project configuration needs to be restricted to settings that really concern the specific Nominatim installation.
52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
|
|
require_once(CONST_LibDir.'/init-website.php');
|
|
require_once(CONST_LibDir.'/log.php');
|
|
require_once(CONST_LibDir.'/output.php');
|
|
ini_set('memory_limit', '200M');
|
|
|
|
$oParams = new Nominatim\ParameterParser();
|
|
$sOutputFormat = $oParams->getSet('format', array('json'), 'json');
|
|
set_exception_handler_by_format($sOutputFormat);
|
|
|
|
$iDays = $oParams->getInt('days', false);
|
|
$bReduced = $oParams->getBool('reduced', false);
|
|
$sClass = $oParams->getString('class', false);
|
|
|
|
$oDB = new Nominatim\DB();
|
|
$oDB->connect();
|
|
|
|
$iTotalBroken = (int) $oDB->getOne('SELECT count(*) FROM import_polygon_error');
|
|
|
|
$aPolygons = array();
|
|
while ($iTotalBroken && empty($aPolygons)) {
|
|
$sSQL = 'SELECT osm_type, osm_id, class, type, name->\'name\' as "name",';
|
|
$sSQL .= 'country_code, errormessage, updated';
|
|
$sSQL .= ' FROM import_polygon_error';
|
|
|
|
$aWhere = array();
|
|
if ($iDays) {
|
|
$aWhere[] = "updated > 'now'::timestamp - '".$iDays." day'::interval";
|
|
$iDays++;
|
|
}
|
|
|
|
if ($bReduced) $aWhere[] = "errormessage like 'Area reduced%'";
|
|
if ($sClass) $sWhere[] = "class = '".pg_escape_string($sClass)."'";
|
|
|
|
if (!empty($aWhere)) {
|
|
$sSQL .= ' WHERE '.join(' and ', $aWhere);
|
|
}
|
|
|
|
$sSQL .= ' ORDER BY updated desc LIMIT 1000';
|
|
$aPolygons = $oDB->getAll($sSQL);
|
|
}
|
|
|
|
if (CONST_Debug) {
|
|
var_dump($aPolygons);
|
|
exit;
|
|
}
|
|
|
|
if ($sOutputFormat == 'json') {
|
|
javascript_renderData($aPolygons);
|
|
}
|