You are here

function login_security_update_6002 in Login Security 6

Variable clean up update as for #866068 http://drupal.org/node/866068

Allows to change email recipient

Return value

array

File

./login_security.install, line 159
Login Security installation routines

Code

function login_security_update_6002() {
  $ret = array();
  $admin_name = db_result(db_query('SELECT name FROM {users} WHERE uid = 1'));

  // Adjust the 'blocked user' email notification variables
  $blocked_email = variable_get('login_security_user_blocked_email', LOGIN_SECURITY_USER_BLOCKED_EMAIL);
  $blocked_email_user = variable_get('login_security_user_blocked_email_user', LOGIN_SECURITY_USER_BLOCKED_EMAIL_USER);
  if ($blocked_email && $blocked_email_user === '') {
    variable_set('login_security_user_blocked_email_user', $admin_name);
  }

  // Adjust the 'suspect activity' email notification variables
  $activity_email = variable_get('login_security_login_activity_email', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL);
  $activity_email_user = variable_get('login_security_login_activity_email_user', LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_USER);
  if ($activity_email && $activity_email_user === '') {
    variable_set('login_security_login_activity_email_user', $admin_name);
  }

  // Clean up the now obsolete boolean variables
  variable_del('login_security_user_blocked_email');
  variable_del('login_security_login_activity_email');
  return $ret;
}