mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Misc
* wrap db test in try/catch block * escape more mysql8 keywords
This commit is contained in:
@@ -56,14 +56,16 @@ class DB
|
||||
if (strstr($options['host'], ':'))
|
||||
[$options['host'], $port] = explode(':', $options['host']);
|
||||
|
||||
if ($link = @mysqli_connect($options['host'], $options['user'], $options['pass'], $options['db'], $port ?: $defPort))
|
||||
{
|
||||
try {
|
||||
$link = @mysqli_connect($options['host'], $options['user'], $options['pass'], $options['db'], $port ?: $defPort);
|
||||
mysqli_close($link);
|
||||
return true;
|
||||
}
|
||||
|
||||
$err = '['.mysqli_connect_errno().'] '.mysqli_connect_error();
|
||||
return false;
|
||||
catch (Exception $e)
|
||||
{
|
||||
$err = '['.mysqli_connect_errno().'] '.mysqli_connect_error();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function errorHandler($message, $data)
|
||||
|
||||
Reference in New Issue
Block a user