From 111cca8c9ab882d554b072a05d1dfe4afe58657e Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 1 Mar 2021 22:17:16 +0100 Subject: [PATCH] return database version with status API --- lib-php/Status.php | 6 ++++++ lib-php/website/status.php | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/lib-php/Status.php b/lib-php/Status.php index a276c4d5..2d9e78db 100644 --- a/lib-php/Status.php +++ b/lib-php/Status.php @@ -56,4 +56,10 @@ class Status return $iDataDateEpoch; } + + public function databaseVersion() + { + $sSQL = 'SELECT value FROM nominatim_properties WHERE property = \'database_version\''; + return $this->oDB->getOne($sSQL); + } } diff --git a/lib-php/website/status.php b/lib-php/website/status.php index 3bb2ffa1..7c7eb928 100644 --- a/lib-php/website/status.php +++ b/lib-php/website/status.php @@ -40,6 +40,10 @@ if ($sOutputFormat == 'json') { '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';