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