diff --git a/inc/database.php b/inc/database.php index c2612493..380a0837 100644 --- a/inc/database.php +++ b/inc/database.php @@ -70,9 +70,9 @@ function sql_open() { if (!empty($config['db']['dsn'])) $dsn .= ';' . $config['db']['dsn']; try { - $options = array( + $options = [ PDO::ATTR_TIMEOUT => $config['db']['timeout'], - ); + ]; if ($config['db']['type'] == "mysql") $options[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = true; @@ -81,13 +81,11 @@ function sql_open() { $options[PDO::ATTR_PERSISTENT] = true; $pdo = new PDO($dsn, $config['db']['user'], $config['db']['password'], $options); - if ($config['debug']) + if ($config['debug']) { $debug['time']['db_connect'] = '~' . round((microtime(true) - $start) * 1000, 2) . 'ms'; - if ($config['db']['type'] == "mysql"){ - if (mysql_version() >= 50503) - query('SET NAMES utf8mb4') or error(db_error()); - else + if ($config['db']['type'] == "mysql") { query('SET NAMES utf8') or error(db_error()); + } } return $pdo; } catch(PDOException $e) {