public function SiteAuditCheckWatchdog404::calculateScore in Site Audit 7
Same name and namespace in other branches
- 8.2 Check/Watchdog/404.php \SiteAuditCheckWatchdog404::calculateScore()
Implements \SiteAudit\Check\Abstract\calculateScore().
Overrides SiteAuditCheckAbstract::calculateScore
File
- Check/
Watchdog/ 404.php, line 67 - Contains \SiteAudit\Check\Watchdog\404.
Class
- SiteAuditCheckWatchdog404
- Class SiteAuditCheckWatchdog404.
Code
public function calculateScore() {
$sql_query = 'SELECT COUNT(wid) ';
$sql_query .= 'FROM {watchdog} ';
$sql_query .= 'WHERE type=:type';
$this->registry['count_404'] = db_query($sql_query, array(
':type' => 'page not found',
))
->fetchField();
$this->registry['percent_404'] = 0;
// @TODO: Aggregate 404 entries and return top 10.
if (!$this->registry['count_404']) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}
$this->registry['percent_404'] = round($this->registry['count_404'] / $this->registry['count_entries'] * 100);
if ($this->registry['percent_404'] >= 10) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
}