public function SiteAuditCheckDatabaseEngine::calculateScore in Site Audit 7
Same name and namespace in other branches
- 8.2 Check/Database/Engine.php \SiteAuditCheckDatabaseEngine::calculateScore()
Implements \SiteAudit\Check\Abstract\calculateScore().
Overrides SiteAuditCheckAbstract::calculateScore
File
- Check/
Database/ Engine.php, line 91 - Contains \SiteAudit\Check\Database\Engine.
Class
- SiteAuditCheckDatabaseEngine
- Class SiteAuditCheckDatabaseEngine.
Code
public function calculateScore() {
if (version_compare(DRUSH_VERSION, 7, '>=')) {
$sql = drush_sql_get_class();
$db_spec = $sql
->db_spec();
}
else {
$db_spec = _drush_sql_get_db_spec();
}
$sql_query = 'SELECT TABLE_NAME AS name ';
$sql_query .= ', ENGINE ';
$sql_query .= 'FROM information_schema.TABLES ';
$sql_query .= 'WHERE TABLES.table_schema = :dbname ';
$sql_query .= 'AND ENGINE != :engine ';
$result = db_query($sql_query, array(
':dbname' => $db_spec['database'],
':engine' => 'InnoDB',
));
if (!$result
->rowCount()) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}
foreach ($result as $row) {
$this->registry['engine_tables'][$row->name] = $row->ENGINE;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
}