return database version with status API

This commit is contained in:
Sarah Hoffmann 2021-03-01 22:17:16 +01:00
parent 7ae9c3a9f0
commit 111cca8c9a
2 changed files with 10 additions and 0 deletions

View File

@ -56,4 +56,10 @@ class Status
return $iDataDateEpoch; return $iDataDateEpoch;
} }
public function databaseVersion()
{
$sSQL = 'SELECT value FROM nominatim_properties WHERE property = \'database_version\'';
return $this->oDB->getOne($sSQL);
}
} }

View File

@ -40,6 +40,10 @@ if ($sOutputFormat == 'json') {
'data_updated' => (new DateTime('@'.$epoch))->format(DateTime::RFC3339), 'data_updated' => (new DateTime('@'.$epoch))->format(DateTime::RFC3339),
'software_version' => CONST_NominatimVersion 'software_version' => CONST_NominatimVersion
); );
$sDatabaseVersion = $oStatus->databaseVersion();
if ($sDatabaseVersion) {
$aResponse['database_version'] = $sDatabaseVersion;
}
javascript_renderData($aResponse); javascript_renderData($aResponse);
} else { } else {
echo 'OK'; echo 'OK';