refactor: add database connect method

This commit is contained in:
grandeljay 2023-09-25 12:14:42 +02:00
parent 9f22376a34
commit f0b67a0529
3 changed files with 6 additions and 0 deletions

View file

@ -72,6 +72,7 @@ if (
DATABASE_USER,
DATABASE_PASSWORD
);
$database->connect();
/**
* Options

View file

@ -28,6 +28,10 @@ class Database
public string $user,
public string $password,
) {
}
public function connect(): void
{
$dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database . ';port=3306;charset=utf8';
$options = array('placeholders' => array());

View file

@ -256,6 +256,7 @@ switch ($step) {
$_SESSION['DATABASE_USER'],
$_SESSION['DATABASE_PASSWORD']
);
$database->connect();
unset($_SESSION);
$database->query('SET foreign_key_checks = 0;');