Merge branch 'master-read-only-check' into next

This commit is contained in:
Sebastian Grewe 2014-01-27 13:26:14 +01:00
commit b5cb8171ba

View File

@ -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");