You are here

function flood_unblock_clear_event in Flood Unblock 7

The function that clear the flood.

5 calls to flood_unblock_clear_event()
flood_unblock_drush_clear in ./flood_unblock.drush.inc
Clear the flood events.
flood_unblock_settings_submit in ./flood_unblock.admin.inc
The submit function.
_flood_unblock_services_all in flood_unblock_services/flood_unblock_services.services.inc
Services unblock all operation callback.
_flood_unblock_services_ip in flood_unblock_services/flood_unblock_services.services.inc
Services unblock ip operation callback.
_flood_unblock_services_user in flood_unblock_services/flood_unblock_services.services.inc
Services unblock user operation callback.

File

./flood_unblock.module, line 40
The module file

Code

function flood_unblock_clear_event($type, $identifier) {
  $txn = db_transaction();
  try {
    $query = db_delete('flood')
      ->condition('event', $type);
    if (isset($identifier)) {
      $query
        ->condition('identifier', $identifier);
    }
    $success = $query
      ->execute();
    if ($success) {
      drupal_set_message(t('Flood entries cleared.'), 'status', FALSE);
    }
  } catch (Exception $e) {

    // Something went wrong somewhere, so roll back now.
    $txn
      ->rollback();

    // Log the exception to watchdog.
    watchdog_exception('type', $e);
    drupal_set_message("Error: " . $e, 'error');
  }
}