3 @define('CONST_ConnectionBucket_PageType', 'Status');
 
   5 require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
 
   6 require_once(CONST_BasePath.'/lib/init-website.php');
 
   7 require_once(CONST_BasePath.'/lib/ParameterParser.php');
 
   8 require_once(CONST_BasePath.'/lib/Status.php');
 
  10 $oParams = new Nominatim\ParameterParser();
 
  11 $sOutputFormat = $oParams->getSet('format', array('text', 'json'), 'text');
 
  13 $oDB = DB::connect(CONST_Database_DSN, false);
 
  14 $oStatus = new Nominatim\Status($oDB);
 
  17 if ($sOutputFormat == 'json') {
 
  18     header('content-type: application/json; charset=UTF-8');
 
  24 } catch (Exception $oErr) {
 
  25     if ($sOutputFormat == 'json') {
 
  27                       'status' => $oErr->getCode(),
 
  28                       'message' => $oErr->getMessage()
 
  30         javascript_renderData($aResponse);
 
  32         header('HTTP/1.0 500 Internal Server Error');
 
  33         echo 'ERROR: '.$oErr->getMessage();
 
  39 if ($sOutputFormat == 'json') {
 
  40     $epoch = $oStatus->dataDate();
 
  44                   'data_updated' => (new DateTime('@'.$epoch))->format(DateTime::RFC3339)
 
  46     javascript_renderData($aResponse);