You are here

function tfa_basic_cron in TFA Basic plugins 7

Implements hook_cron().

File

./tfa_basic.module, line 140

Code

function tfa_basic_cron() {

  // Delete trusted browser entries older than expiration.
  $expiration = variable_get('tfa_basic_trust_cookie_expiration', 3600 * 24 * 30);
  $num_deleted = db_delete('tfa_trusted_browser')
    ->condition('created', REQUEST_TIME - $expiration, '<')
    ->execute();
  if ($num_deleted) {
    watchdog('tfa_basic', 'Removed !num TFA trusted browsers older than !time', array(
      '!num' => $num_deleted,
      '!time' => REQUEST_TIME - $expiration,
    ), WATCHDOG_INFO);
  }

  // Delete accepted codes older than expiration.
  $accepted_expiration = variable_get('tfa_basic_accepted_code_expiration', 3600 * 24);
  db_delete('tfa_accepted_code')
    ->condition('time_accepted', REQUEST_TIME - $accepted_expiration, '<')
    ->execute();
}