mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Maintenance
* toggle maintenance mode in a more reasonable manner (i.e. not when displaying help test) * move connectivity tests to class DB * restore generate everything functionality when running --sql and --build with an empty parameter set
This commit is contained in:
@@ -49,6 +49,23 @@ class DB
|
||||
self::$connectionCache[$idx] = true;
|
||||
}
|
||||
|
||||
public static function test(array $options, ?string &$err = '') : bool
|
||||
{
|
||||
$defPort = ini_get('mysqli.default_port');
|
||||
$port = 0;
|
||||
if (strstr($options['host'], ':'))
|
||||
[$options['host'], $port] = explode(':', $options['host']);
|
||||
|
||||
if ($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;
|
||||
}
|
||||
|
||||
public static function errorHandler($message, $data)
|
||||
{
|
||||
if (!error_reporting())
|
||||
|
||||
Reference in New Issue
Block a user