1 user.install user_update_1004()

Moves login flood settings from variable to config.

Related topics

File

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

Code

function user_update_1004() {
  // Migrate variables to config.
  $config = config('user.flood');
  $config->set('flood_uid_only', update_variable_get('user_failed_login_identifier_uid_only', FALSE));
  $config->set('flood_ip_limit', update_variable_get('user_failed_login_ip_limit', 50));
  $config->set('flood_ip_window', update_variable_get('user_failed_login_ip_window', 3600));
  $config->set('flood_user_limit', update_variable_get('user_failed_login_user_limit', 5));
  $config->set('flood_user_window', update_variable_get('user_failed_login_user_window', 21600));
  $config->save();

  // Delete variables.
  update_variable_del('user_failed_login_identifier_uid_only');
  update_variable_del('user_failed_login_ip_limit');
  update_variable_del('user_failed_login_ip_window');
  update_variable_del('user_failed_login_user_limit');
  update_variable_del('user_failed_login_user_window');
}