You are here

private static function CleantalkFuncs::_apbct_alt_sessions__remove_old in Anti Spam by CleanTalk 8.3

Same name and namespace in other branches
  1. 8.4 src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::_apbct_alt_sessions__remove_old()
  2. 9.1.x src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::_apbct_alt_sessions__remove_old()

Clean 'cleantalk_sessions' table

1 call to CleantalkFuncs::_apbct_alt_sessions__remove_old()
CleantalkFuncs::apbct_setcookie in src/CleantalkFuncs.php
Save our variables into cookies OR sessions

File

src/CleantalkFuncs.php, line 109

Class

CleantalkFuncs
Cleantalk class create request

Namespace

Drupal\cleantalk

Code

private static function _apbct_alt_sessions__remove_old() {
  if (rand(0, 1000) < APBCT_SESSION__CHANCE_TO_CLEAN) {
    $connection = \Drupal::database();
    $connection
      ->query("DELETE\n      FROM {cleantalk_sessions}\n      WHERE last_update < NOW() - INTERVAL " . APBCT_SESSION__LIVE_TIME . " SECOND\n      LIMIT 100000;");
  }
}