You are here

function honeypot_update_7101 in Honeypot 7

Transfer previous honeypot trigger info from {flood} to {honeypot_user}.

File

./honeypot.install, line 170
Install, update and uninstall functions for the Honeypot module.

Code

function honeypot_update_7101() {

  // Move all 'honeypot' events, which are honeypot captures for anonymous
  // users, to the {honeypot_user}-table, since the latter now supports
  // tracking based on ip/hostname for anonymous users.
  $query = db_select('flood', 'f')
    ->condition('event', 'honeypot');
  $query
    ->addExpression('0', 'uid');
  $query
    ->addField('f', 'identifier', 'hostname');
  $query
    ->addField('f', 'timestamp');
  db_insert('honeypot_user')
    ->from($query)
    ->execute();

  // Clean up the flood table by removing our events, since we are no longer
  // relying on the flood mechanism to track anonymous honeypot captures.
  flood_clear_event('honeypot');
}