]> git.openstreetmap.org Git - nominatim.git/commitdiff
add API call to get database age
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 16 Nov 2015 21:06:53 +0000 (22:06 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 16 Nov 2015 21:06:53 +0000 (22:06 +0100)
website/last_update.php [new file with mode: 0644]

diff --git a/website/last_update.php b/website/last_update.php
new file mode 100644 (file)
index 0000000..a843586
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+       @define('CONST_ConnectionBucket_PageType', 'Status');
+
+       require_once(dirname(dirname(__FILE__)).'/lib/init-website.php');
+
+       function statusError($sMsg)
+       {
+               header("HTTP/1.0 500 Internal Server Error");
+               echo "ERROR: ".$sMsg;
+               exit;
+       }
+
+       $oDB =& DB::connect(CONST_Database_DSN, false);
+       if (!$oDB || PEAR::isError($oDB))
+       {
+               statusError("No database");
+       }
+
+       $sLastUpdate = $oDB->getOne("select * from import_status");
+       if (PEAR::isError($sLastUpdate))
+       {
+               statusError("Update status unknown.");
+       }
+       echo $sLastUpdate;
+       exit;
+