X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/db3ced17bbfff00411f506d8c84419c875959d5e..e407558f767d1c3930624d2186c6c9934ab8a26b:/lib-php/website/status.php diff --git a/lib-php/website/status.php b/lib-php/website/status.php index 9f030fb3..03e56f65 100644 --- a/lib-php/website/status.php +++ b/lib-php/website/status.php @@ -17,6 +17,23 @@ if ($sOutputFormat == 'json') { try { $oStatus = new Nominatim\Status($oDB); $oStatus->status(); + + if ($sOutputFormat == 'json') { + $epoch = $oStatus->dataDate(); + $aResponse = array( + 'status' => 0, + 'message' => 'OK', + '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( @@ -28,20 +45,4 @@ try { 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;