<?php
+/**
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This file is part of Nominatim. (https://nominatim.org)
+ *
+ * Copyright (C) 2022 by the Nominatim developer community.
+ * For a full list of authors see the git log.
+ */
namespace Nominatim;
+require_once(CONST_TokenizerDir.'/tokenizer.php');
+
use Exception;
class Status
throw new Exception('Database connection failed', 700);
}
- $sStandardWord = $this->oDB->getOne("SELECT make_standard_name('a')");
- if ($sStandardWord === false) {
- throw new Exception('Module failed', 701);
- }
-
- if ($sStandardWord != 'a') {
- throw new Exception('Module call failed', 702);
- }
-
- $sSQL = 'SELECT word_id, word_token, word, class, type, country_code, ';
- $sSQL .= "operator, search_name_count FROM word WHERE word_token IN (' a')";
- $iWordID = $this->oDB->getOne($sSQL);
- if ($iWordID === false) {
- throw new Exception('Query failed', 703);
- }
- if (!$iWordID) {
- throw new Exception('No value', 704);
- }
+ $oTokenizer = new \Nominatim\Tokenizer($this->oDB);
+ $oTokenizer->checkStatus();
}
public function dataDate()
$iDataDateEpoch = $this->oDB->getOne($sSQL);
if ($iDataDateEpoch === false) {
- throw Exception('Data date query failed '.$iDataDateEpoch->getMessage(), 705);
+ throw new Exception('Import date is not available', 705);
}
return $iDataDateEpoch;
}
+
+ public function databaseVersion()
+ {
+ $sSQL = 'SELECT value FROM nominatim_properties WHERE property = \'database_version\'';
+ return $this->oDB->getOne($sSQL);
+ }
}