You are here

function user_expire_update_1 in User Expire 7

Deletes any leftover uids associated with deleted accounts.

File

./user_expire.install, line 74
Install, update and uninstall functions for the User expire module.

Code

function user_expire_update_1() {
  $query = db_select('user_expire', 'ue');
  $query
    ->leftJoin('users', 'u', 'ue.uid = u.uid');
  $deleted_uids = $query
    ->fields('ue', array(
    'uid',
  ))
    ->isNull('u.uid')
    ->execute();
  foreach ($deleted_uids as $deleted_uid) {
    db_delete('user_expire')
      ->condition('uid', $deleted_uid->uid)
      ->execute();
  }
}