1 user.install user_update_1005()

Moves user mail settings from variable to config.

Related topics

File

core/modules/user/user.install, line 335
Install, update and uninstall functions for the user module.

Code

function user_update_1005() {
  // Migrate variables to config.
  $config = config('user.mail');
  $config->set('register_admin_created_subject', update_variable_get('register_admin_created_subject', 'An administrator created an account for you at [site:name]'));
  $config->set('register_admin_created_body', update_variable_get('register_admin_created_body', '[user:name],\n\nA site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n--  [site:name] team'));
  $config->set('register_pending_approval_subject', update_variable_get('register_pending_approval_subject', 'Account details for [user:name] at [site:name] (pending admin approval)'));
  $config->set('register_pending_approval_body', update_variable_get('register_pending_approval_body', '[user:name],\n\nThank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another email containing information about how to log in, set your password, and other details.\n\n\n--  [site:name] team'));
  $config->set('register_no_approval_required_subject', update_variable_get('register_no_approval_required_subject', 'Account details for [user:name] at [site:name]'));
  $config->set('register_no_approval_required_body', update_variable_get('register_no_approval_required_body', '[user:name],\n\nThank you for registering at [site:name]. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n--  [site:name] team'));
  $config->set('password_reset_subject', update_variable_get('password_reset_subject', 'Password reset information for [user:name] at [site:name]'));
  $config->set('password_reset_body', update_variable_get('password_reset_body', '[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now reset your password by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once and will lead you to a page where you can set your password. It expires after one day and nothing will happen if it is not used.\n\n--  [site:name] team'));
  $config->set('status_activated_subject', update_variable_get('status_activated_subject', 'Account details for [user:name] at [site:name] (approved)'));
  $config->set('status_activated_body', update_variable_get('status_activated_body', '[user:name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n--  [site:name] team'));
  $config->set('status_blocked_subject', update_variable_get('status_blocked_subject', 'Account details for [user:name] at [site:name] (blocked)'));
  $config->set('status_blocked_body', update_variable_get('status_blocked_body', '[user:name],\n\nYour account on [site:name] has been blocked.\n\n--  [site:name] team'));
  $config->set('cancel_confirm_subject', update_variable_get('cancel_confirm_subject', 'Account cancellation request for [user:name] at [site:name]'));
  $config->set('cancel_confirm_body', update_variable_get('cancel_confirm_body', '[user:name],\n\nA request to cancel your account has been made at [site:name].\n\nYou may now cancel your account on [site:url:brief] by clicking this link or copying and pasting it into your browser:\n\n[user:cancel-url]\n\nNOTE: The cancellation of your account is not reversible.\n\nThis link expires in one day and nothing will happen if it is not used.\n\n--  [site:name] team'));
  $config->set('status_canceled_subject', update_variable_get('status_canceled_subject', 'Account details for [user:name] at [site:name] (canceled)'));
  $config->set('status_canceled_body', update_variable_get('status_canceled_body', '[user:name],\n\nYour account on [site:name] has been canceled.\n\n--  [site:name] team'));
  $config->save();

  // Delete variables.
  update_variable_del('register_admin_created_subject');
  update_variable_del('register_admin_created_body');
  update_variable_del('register_pending_approval_subject');
  update_variable_del('register_pending_approval_body');
  update_variable_del('register_no_approval_required_subject');
  update_variable_del('register_no_approval_required_body');
  update_variable_del('password_reset_subject');
  update_variable_del('password_reset_body');
  update_variable_del('status_activated_subject');
  update_variable_del('status_activated_body');
  update_variable_del('status_blocked_subject');
  update_variable_del('status_blocked_body');
  update_variable_del('cancel_confirm_subject');
  update_variable_del('cancel_confirm_body');
  update_variable_del('status_canceled_subject');
  update_variable_del('status_canceled_body');
}