function honeypot_cron in Honeypot 7
Same name and namespace in other branches
- 8 honeypot.module \honeypot_cron()
- 6 honeypot.module \honeypot_cron()
- 2.0.x honeypot.module \honeypot_cron()
Implements hook_cron().
4 calls to honeypot_cron()
- HoneypotCssTestCase::testHoneypotCssAvailability in ./honeypot.test 
- Test CSS file availability.
- HoneypotCssTestCase::testHoneypotCssNonpublicFileSystem in ./honeypot.test 
- Test CSS works when default file scheme is not public://
- HoneypotCssTestCase::testHoneypotCssRegenerationOnCron in ./honeypot.test 
- Test cron-based CSS file regeneration.
- HoneypotCssTestCase::testHoneypotCssUpdateOnCron in ./honeypot.test 
- Test cron-based CSS file update.
File
- ./honeypot.module, line 43 
- Honeypot module, for deterring spam bots from completing Drupal forms.
Code
function honeypot_cron() {
  // Delete {honeypot_user} entries older than the value of honeypot_expire.
  db_delete('honeypot_user')
    ->condition('timestamp', REQUEST_TIME - variable_get('honeypot_expire', 300), '<')
    ->execute();
  // Regenerate the honeypot css file if it does not exist or is outdated.
  $honeypot_css = honeypot_get_css_file_path();
  $honeypot_element_name = variable_get('honeypot_element_name', 'url');
  if (!file_exists($honeypot_css) || !honeypot_check_css($honeypot_element_name)) {
    honeypot_create_css($honeypot_element_name);
  }
}