small cleanup

This commit is contained in:
Joey Kimsey
2025-06-20 11:29:47 -04:00
parent 89d30a8d36
commit e9c3fd84dd

View File

@ -91,14 +91,19 @@ class Database {
$this->errorMessage = $Exception->getMessage();
}
}
if ( !$this->enabled() ) {
if ( ! $this->enabled() ) {
$this->error = true;
$this->errorMessage = 'Database disabled in config.';
}
if ( $this->error === false ) {
try {
Debug::debug( 'Attempting to connect to DB with config credentials.' );
$this->pdo = new PDO( 'mysql:host=' . Config::getValue( 'database/dbHost' ) . ';dbname=' . Config::getValue( 'database/dbName' ), Config::getValue( 'database/dbUsername' ), Config::getValue( 'database/dbPassword' ) );
$this->pdo = new PDO(
'mysql:host=' . Config::getValue( 'database/dbHost' ) .
';dbname=' . Config::getValue( 'database/dbName' ),
Config::getValue( 'database/dbUsername' ),
Config::getValue( 'database/dbPassword' )
);
} catch ( PDOException $Exception ) {
$this->error = true;
$this->errorMessage = $Exception->getMessage();