You are here

public function CleantalkSFW::sfw_update_logs in Anti Spam by CleanTalk 7.4

Same name and namespace in other branches
  1. 7.5 src/CleantalkSFW.php \CleantalkSFW::sfw_update_logs()
  2. 7.2 cleantalk.module \CleanTalkSFW::sfw_update_logs()

File

src/CleantalkSFW.php, line 89

Class

CleantalkSFW

Code

public function sfw_update_logs($ip, $result) {
  if ($ip === NULL || $result === NULL) {
    return;
  }
  db_merge('cleantalk_sfw_logs')
    ->key(array(
    'ip' => $ip,
  ))
    ->fields(array(
    'ip' => $ip,
    'all_entries' => 1,
    'blocked_entries' => 1,
    'entries_timestamp' => time(),
  ))
    ->expression('all_entries', 'all_entries + :inc', array(
    ':inc' => 1,
  ))
    ->expression('blocked_entries', 'blocked_entries + :inc', array(
    ':inc' => 1,
  ))
    ->expression('entries_timestamp', time())
    ->execute();
}