You are here

protected function RateBotDetector::checkAgent in Rate 8.2

Check if the given user agent matches the local bot database.

Return value

bool True if match found; false otherwise.

1 call to RateBotDetector::checkAgent()
RateBotDetector::checkIsBot in src/Plugin/RateBotDetector.php
Check if the current user is blocked.

File

src/Plugin/RateBotDetector.php, line 138

Class

RateBotDetector
The rate.bot_detector service.

Namespace

Drupal\rate\Plugin

Code

protected function checkAgent() {
  $sql = 'SELECT 1 FROM {rate_bot_agent} WHERE :agent LIKE pattern LIMIT 1';
  return (bool) $this->database
    ->query($sql, [
    ':agent' => $this->agent,
  ])
    ->fetchField();
}