X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/a59474c573cdc91102cf9ef343ce0e979fe4dc9d..91129b37f605a06f85bc8aa07eede84fb16ad644:/lib/lib.php diff --git a/lib/lib.php b/lib/lib.php index a0f67ed8..7553117f 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -33,6 +33,18 @@ function getCacheMemoryMB() return (int)($aMatches[1]/1024); } +function getDatabaseDate(&$oDB) +{ + // Find the newest node in the DB + $iLastOSMID = $oDB->getOne("select max(osm_id) from place where osm_type = 'N'"); + // Lookup the timestamp that node was created + $sLastNodeURL = 'http://www.openstreetmap.org/api/0.6/node/'.$iLastOSMID."/1"; + $sLastNodeXML = file_get_contents($sLastNodeURL); + preg_match('#timestamp="(([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z)"#', $sLastNodeXML, $aLastNodeDate); + + return $aLastNodeDate[1]; +} + function bySearchRank($a, $b) {