refactor: add database connect
method
This commit is contained in:
parent
9f22376a34
commit
f0b67a0529
3 changed files with 6 additions and 0 deletions
|
@ -72,6 +72,7 @@ if (
|
|||
DATABASE_USER,
|
||||
DATABASE_PASSWORD
|
||||
);
|
||||
$database->connect();
|
||||
|
||||
/**
|
||||
* Options
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -256,6 +256,7 @@ switch ($step) {
|
|||
$_SESSION['DATABASE_USER'],
|
||||
$_SESSION['DATABASE_PASSWORD']
|
||||
);
|
||||
$database->connect();
|
||||
unset($_SESSION);
|
||||
|
||||
$database->query('SET foreign_key_checks = 0;');
|
||||
|
|
Loading…
Reference in a new issue