You are here

function captcha_cron in CAPTCHA 7

Same name and namespace in other branches
  1. 8 captcha.module \captcha_cron()
  2. 6.2 captcha.module \captcha_cron()

Implements of hook_cron().

Remove old entries from captcha_sessions table.

File

./captcha.module, line 143
This module enables basic CAPTCHA functionality: administrators can add a CAPTCHA to desired forms that users without the 'skip CAPTCHA' permission (typically anonymous visitors) have to solve.

Code

function captcha_cron() {

  // Remove challenges older than 1 day.
  db_delete('captcha_sessions')
    ->condition('timestamp', REQUEST_TIME - 60 * 60 * 24, '<')
    ->execute();
}