3 require_once(CONST_LibDir.'/init-website.php');
4 require_once(CONST_LibDir.'/ParameterParser.php');
5 require_once(CONST_LibDir.'/Status.php');
7 $oParams = new Nominatim\ParameterParser();
8 $sOutputFormat = $oParams->getSet('format', array('text', 'json'), 'text');
10 $oDB = new Nominatim\DB();
12 if ($sOutputFormat == 'json') {
13 header('content-type: application/json; charset=UTF-8');
18 $oStatus = new Nominatim\Status($oDB);
20 } catch (Exception $oErr) {
21 if ($sOutputFormat == 'json') {
23 'status' => $oErr->getCode(),
24 'message' => $oErr->getMessage()
26 javascript_renderData($aResponse);
28 header('HTTP/1.0 500 Internal Server Error');
29 echo 'ERROR: '.$oErr->getMessage();
35 if ($sOutputFormat == 'json') {
36 $epoch = $oStatus->dataDate();
40 'data_updated' => (new DateTime('@'.$epoch))->format(DateTime::RFC3339)
42 javascript_renderData($aResponse);