3 * SPDX-License-Identifier: GPL-2.0-only
5 * This file is part of Nominatim. (https://nominatim.org)
7 * Copyright (C) 2022 by the Nominatim developer community.
8 * For a full list of authors see the git log.
13 require_once(CONST_TokenizerDir.'/tokenizer.php');
21 public function __construct(&$oDB)
26 public function status()
29 throw new Exception('No database', 700);
33 $this->oDB->connect();
34 } catch (\Nominatim\DatabaseError $e) {
35 throw new Exception('Database connection failed', 700);
38 $oTokenizer = new \Nominatim\Tokenizer($this->oDB);
39 $oTokenizer->checkStatus();
42 public function dataDate()
44 $sSQL = 'SELECT EXTRACT(EPOCH FROM lastimportdate) FROM import_status LIMIT 1';
45 $iDataDateEpoch = $this->oDB->getOne($sSQL);
47 if ($iDataDateEpoch === false) {
48 throw new Exception('Import date is not available', 705);
51 return $iDataDateEpoch;
54 public function databaseVersion()
56 $sSQL = 'SELECT value FROM nominatim_properties WHERE property = \'database_version\'';
57 return $this->oDB->getOne($sSQL);