You are here

function role_expire_update_7100 in Role Expire 7

Issue #2341269: delete orphaned records from 'role_expire' and 'role_expire_length' tables.

File

./role_expire.install, line 77
Role expire install.

Code

function role_expire_update_7100(&$sandbox) {
  $roles = user_roles();
  $rids = array_keys($roles);
  db_query("DELETE FROM {role_expire} WHERE rid NOT IN (:rids)", array(
    ':rids' => $rids,
  ));
  db_query("DELETE FROM {role_expire_length} WHERE rid NOT IN (:rids)", array(
    ':rids' => $rids,
  ));
}