<?php

require __DIR__ . '/../vendor/autoload.php';

use \Exception;
use \TPsoft\DBmodel\DBmodel;
use \TPsoft\BugreportBackend\Maintenance;

global $dbh;

if (Configuration::DB_TYPE == 'mysql') {
	$dbh = new DBmodel(sprintf('mysql:host=%s;dbname=%s;charset=utf8mb4', Configuration::DB_HOST, Configuration::DB_NAME), Configuration::DB_USER, Configuration::DB_PASS);
} else if (Configuration::DB_TYPE == 'sqlite') {
	$dbh = new DBmodel(sprintf('sqlite:%s', Configuration::DB_FILEPATH));
} else {
	throw new Exception('Unknown database type');
}

$maintenance = new Maintenance($dbh);
$maintenance->database();
