X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4faefe156c0a57bae9dd7114ba9fa63ef312187e..399b04596e651f9cbcd8a340b1e13a48aededccb:/lib-php/website/status.php?ds=sidebyside diff --git a/lib-php/website/status.php b/lib-php/website/status.php index 3bb2ffa1..2839f72a 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', + '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,21 +53,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), - 'software_version' => CONST_NominatimVersion - ); - javascript_renderData($aResponse); -} else { - echo 'OK'; } - -exit;