You are here

function regcode_clean_codes in Registration codes 6

Same name and namespace in other branches
  1. 5.3 regcode_api.inc.php \regcode_clean_codes()

Clean up codes

Parameters

$op: Action to perform when cleaning the code: truncate - truncate all codes from db expired - remove expired codes used - remove one-time codes that have been used

1 call to regcode_clean_codes()
regcode_admin_import_submit in ./regcode.admin.php
Handle the processing of a submitted import form

File

./regcode.api.php, line 186
A generic set of functions for interacting with and creating regcodes

Code

function regcode_clean_codes($op = 'truncate') {
  switch ($op) {
    case 'truncate':
      db_query('TRUNCATE {regcode}');
      break;
    case 'expired':
      db_query('DELETE FROM {regcode} WHERE expire < NOW()');
      break;
    case 'used':
      db_query('DELETE FROM {regcode} WHERE uses >= maxuses');
      break;
  }
}