You are here

public function SiteAuditCheckWatchdogAge::calculateScore in Site Audit 7

Same name and namespace in other branches
  1. 8.2 Check/Watchdog/Age.php \SiteAuditCheckWatchdogAge::calculateScore()

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

Overrides SiteAuditCheckAbstract::calculateScore

File

Check/Watchdog/Age.php, line 70
Contains \SiteAudit\Check\Watchdog\Age.

Class

SiteAuditCheckWatchdogAge
Class SiteAuditCheckWatchdogAge.

Code

public function calculateScore() {

  // Age of oldest entry.
  $sql_query = 'SELECT timestamp ';
  $sql_query .= 'FROM {watchdog} ';
  $sql_query .= 'ORDER BY wid ASC ';
  $sql_query .= 'LIMIT 1 ';
  $this->ageOldest = db_query($sql_query)
    ->fetchField();

  // Age of newest entry.
  $sql_query = 'SELECT timestamp ';
  $sql_query .= 'FROM {watchdog} ';
  $sql_query .= 'ORDER BY wid DESC ';
  $sql_query .= 'LIMIT 1 ';
  $this->ageNewest = db_query($sql_query)
    ->fetchField();
  return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
}