You are here

public function DbLog::init in Production check & Production monitor 8

Initializes the check plugin.

Overrides ProdCheckBase::init

File

src/Plugin/ProdCheck/Server/DbLog.php, line 40

Class

DbLog
Dblog report

Namespace

Drupal\prod_check\Plugin\ProdCheck\Server

Code

public function init() {
  $this->errorLevel = 0;
  $this->threshold = 0;

  // @todo this query is broken
  $this->result = \Drupal::database()
    ->query('SELECT COUNT(*) FROM (SELECT count(wid) FROM {watchdog} WHERE type = :type AND severity <= :severity GROUP BY variables HAVING COUNT(wid) >= :threshold) subquery', [
    ':type' => 'php',
    ':severity' => $this->errorLevel,
    ':threshold' => $this->threshold,
  ])
    ->fetchField();
}