[ADDED] Check if master is read-only
Just to ensure we can run at all.
This commit is contained in:
parent
cb1fc8b9c6
commit
f183b586a8
@ -7,6 +7,11 @@ if (!defined('SECURITY'))
|
||||
// Instantiate class, we are using mysqlng
|
||||
$mysqli = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
|
||||
|
||||
// Check if read-only and quit if it is on
|
||||
if ($mysqli->query('/* MYSQLND_MS_MASTER_SWITCH */SELECT @@global.read_only AS read_only')->fetch_object()->read_only == 1) {
|
||||
die('Database is in READ-ONLY mode');
|
||||
}
|
||||
|
||||
/* check connection */
|
||||
if (mysqli_connect_errno()) {
|
||||
die("Failed to connect to database");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user