X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/80f6aca0c22984b79e24a19bc602258dd3caeb34..105597be056bf9cbf3bb4c15f9bc516479e48ee2:/lib-php/website/status.php diff --git a/lib-php/website/status.php b/lib-php/website/status.php index 9f030fb3..8ab11cc4 100644 --- a/lib-php/website/status.php +++ b/lib-php/website/status.php @@ -1,4 +1,12 @@ status(); + + if ($sOutputFormat == 'json') { + $epoch = $oStatus->dataDate(); + $aResponse = array( + 'status' => 0, + 'message' => 'OK', + 'server' => gethostname(), + 'data_updated' => (new DateTime('@'.$epoch))->format(DateTime::RFC3339), + 'software_version' => CONST_NominatimVersion + ); + $sDatabaseVersion = $oStatus->databaseVersion(); + if ($sDatabaseVersion) { + $aResponse['database_version'] = $sDatabaseVersion; + } + javascript_renderData($aResponse); + } else { + echo 'OK'; + } } catch (Exception $oErr) { if ($sOutputFormat == 'json') { $aResponse = array( 'status' => $oErr->getCode(), - 'message' => $oErr->getMessage() + 'message' => $oErr->getMessage(), + 'server' => gethostname() ); javascript_renderData($aResponse); } else { header('HTTP/1.0 500 Internal Server Error'); echo 'ERROR: '.$oErr->getMessage(); } - exit; -} - - -if ($sOutputFormat == 'json') { - $epoch = $oStatus->dataDate(); - $aResponse = array( - 'status' => 0, - 'message' => 'OK', - 'data_updated' => (new DateTime('@'.$epoch))->format(DateTime::RFC3339) - ); - javascript_renderData($aResponse); -} else { - echo 'OK'; } - -exit;