You are here

public function SiteAuditCheckUsersCountAll::calculateScore in Site Audit 8.2

Same name and namespace in other branches
  1. 7 Check/Users/CountAll.php \SiteAuditCheckUsersCountAll::calculateScore()

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

Overrides SiteAuditCheckAbstract::calculateScore

File

Check/Users/CountAll.php, line 65
Contains \SiteAudit\Check\Users\CountAll.

Class

SiteAuditCheckUsersCountAll
Class SiteAuditCheckUsersCountAll.

Code

public function calculateScore() {
  $sql_query = 'SELECT COUNT(uid) ';
  $sql_query .= 'FROM {users} ';
  $sql_query .= 'WHERE uid != 0 ';
  try {
    $this->registry['count_users_all'] = db_query($sql_query)
      ->fetchField();
    if (!$this->registry['count_users_all']) {
      $this->abort = TRUE;
      return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
    }
    return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
  } catch (DatabaseExceptionWrapper $e) {
    $this->abort = TRUE;
    return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
  }
}