You are here

public function SiteAuditCheckUsersRolesList::calculateScore in Site Audit 8.2

Implements \SiteAudit\Check\Abstract\calculateScore().

Overrides SiteAuditCheckAbstract::calculateScore

File

Check/Users/RolesList.php, line 60
Contains \SiteAudit\Check\Users\RolesList.

Class

SiteAuditCheckUsersRolesList
Class SiteAuditCheckUsersRolesList.

Code

public function calculateScore() {
  $sql_query = 'SELECT roles_target_id AS name';
  $sql_query .= ', COUNT(entity_id) AS count_users ';
  $sql_query .= 'FROM {user__roles} ';
  $sql_query .= 'GROUP BY name ';
  $sql_query .= 'ORDER BY name ASC ';
  $result = db_query($sql_query);
  foreach ($result as $row) {
    $this->registry['roles'][$row->name] = $row->count_users;
  }
  return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
}