private function AutobanAnalyzeForm::getAnalyzeResult in Automatic IP ban (Autoban) 8
Get analyze result.
Parameters
array $header: Query header.
int $threshold: Threshold for watchdog entries which added to result.
string $dblog_type_exclude: Exclude dblog types events for log analyze.
Return value
array Watchdog table data as query result.
1 call to AutobanAnalyzeForm::getAnalyzeResult()
- AutobanAnalyzeForm::buildForm in src/Form/ AutobanAnalyzeForm.php 
- Form constructor.
File
- src/Form/ AutobanAnalyzeForm.php, line 255 
Class
- AutobanAnalyzeForm
- Analyze watchdog entries for IP addresses for ban.
Namespace
Drupal\autoban\FormCode
private function getAnalyzeResult(array $header, $threshold, $dblog_type_exclude) {
  $query = $this->connection
    ->select('watchdog', 'log');
  $query
    ->fields('log', [
    'message',
    'variables',
    'type',
  ]);
  $query
    ->addExpression('COUNT(*)', 'cnt');
  $query
    ->condition('log.type', explode("\n", $dblog_type_exclude), 'NOT IN');
  $query
    ->groupBy('log.message, log.variables, log.type');
  $query
    ->having('COUNT(*) >= :threshold', [
    ':threshold' => $threshold,
  ]);
  $table_sort = $query
    ->extend('Drupal\\Core\\Database\\Query\\TableSortExtender')
    ->orderByHeader($header);
  $result = $table_sort
    ->execute()
    ->fetchAll();
  return $result;
}