]> git.openstreetmap.org Git - nominatim.git/blob - website/status.php
query the last updated timestamp only if output format is HTML
[nominatim.git] / website / status.php
1 <?php
2         @define('CONST_ConnectionBucket_PageType', 'Status');
3
4         require_once(dirname(dirname(__FILE__)).'/lib/init-website.php');
5
6         function statusError($sMsg)
7         {
8                 header("HTTP/1.0 500 Internal Server Error");
9                 echo "ERROR: ".$sMsg;
10                 exit;
11         }
12
13         $oDB =& DB::connect(CONST_Database_DSN, false);
14         if (!$oDB || PEAR::isError($oDB))
15         {
16                 statusError("No database");
17         }
18
19         $sStandardWord = $oDB->getOne("select make_standard_name('a')");
20         if (PEAR::isError($sStandardWord))
21         {
22                 statusError("Module failed");
23         }
24         if ($sStandardWord != 'a')
25         {
26                 statusError("Module call failed");
27         }
28
29         $iWordID = $oDB->getOne("select word_id,word_token, word, class, type, country_code, operator, search_name_count from word where word_token in (' a')");
30         if (PEAR::isError($iWordID))
31         {
32                 statusError("Query failed");
33         }
34         if (!$iWordID)
35         {
36                 statusError("No value");
37         }
38
39         echo "OK";
40         exit;
41