public function WatchdogPhp::calculateScore in Site Audit 8.3
.
Overrides SiteAuditCheckBase::calculateScore
File
- src/Plugin/ SiteAuditCheck/ WatchdogPhp.php, line 65 
Class
- WatchdogPhp
- Provides the WatchdogPhp Check.
Namespace
Drupal\site_audit\Plugin\SiteAuditCheckCode
public function calculateScore() {
  $this->registry->php_counts = [];
  $this->registry->php_count_total = 0;
  $this->registry->percent_php = 0;
  $query = \Drupal::database()
    ->select('watchdog');
  $query
    ->addExpression('COUNT(*)', 'count');
  $query
    ->addField('watchdog', 'severity');
  $query
    ->groupBy('severity');
  $query
    ->orderBy('severity', 'ASC');
  $result = $query
    ->execute();
  $severity_levels = $this
    ->watchdog_severity_levels();
  while ($row = $result
    ->fetchObject()) {
    $row->severity = $severity_levels[$row->severity];
    // $row = watchdog_format_result($result);
    if (!isset($this->registry->php_counts[$row->severity])) {
      $this->registry->php_counts[$row->severity] = 0;
    }
    $this->registry->php_counts[$row->severity]++;
    $this->registry->php_count_total++;
  }
  $this->registry->percent_php = round($this->registry->php_count_total / $this->registry->count_entries * 100, 2);
  if ($this->registry->percent_php >= 10) {
    return SiteAuditCheckBase::AUDIT_CHECK_SCORE_WARN;
  }
  return SiteAuditCheckBase::AUDIT_CHECK_SCORE_INFO;
}