You are here

public function AntiFlood::clear_table in Anti Spam by CleanTalk 9.1.x

Same name and namespace in other branches
  1. 8.4 src/lib/Cleantalk/Common/Firewall/Modules/AntiFlood.php \Cleantalk\Common\Firewall\Modules\AntiFlood::clear_table()
1 call to AntiFlood::clear_table()
AntiFlood::check in src/lib/Cleantalk/Common/Firewall/Modules/AntiFlood.php
Use this method to execute main logic of the module.

File

src/lib/Cleantalk/Common/Firewall/Modules/AntiFlood.php, line 130

Class

AntiFlood

Namespace

Cleantalk\Common\Firewall\Modules

Code

public function clear_table() {
  if (rand(0, 100) < $this->chance_to_clean) {
    $interval_start = Helper::time__get_interval_start($this->store_interval);
    $this->db
      ->execute("DELETE\n\t\t\t\tFROM " . $this->db__table__ac_logs . "\n\t\t\t\tWHERE interval_start < " . $interval_start . "\n\t\t\t\tAND ua = '{$this->sign}'\n\t\t\t\tLIMIT 100000;");
  }
}