Recommend InnoDB engine in validation (#9799)

This commit is contained in:
Tony Murray
2019-02-12 17:55:52 -06:00
committed by GitHub
parent 1d1962af83
commit 2f8964ce27

View File

@ -71,6 +71,7 @@ class Database extends BaseValidation
$validator->warn("Your database schema ($current) is newer than expected ($latest). If you just switched to the stable release from the daily release, your database is in between releases and this will be resolved with the next release.");
}
$this->checkMysqlEngine($validator);
$this->checkCollation($validator);
$this->checkSchema($validator);
}
@ -104,6 +105,19 @@ class Database extends BaseValidation
}
}
private function checkMysqlEngine(Validator $validator)
{
$db = Config::get('db_name', 'librenms');
$query = "SELECT `TABLE_NAME` FROM information_schema.tables WHERE `TABLE_SCHEMA` = '$db' && `ENGINE` != 'InnoDB'";
$tables = dbFetchRows($query);
if (!empty($tables)) {
$validator->result(
ValidationResult::warn("Some tables are not using the recommended InnoDB engine, this may cause you issues.")
->setList('Tables', $tables)
);
}
}
private function checkCollation(Validator $validator)
{
$db_name = dbFetchCell('SELECT DATABASE()');