function spambot_update_8004 in Spambot 8
Update existing whitelists.
File
- ./
spambot.install, line 142 - Install and update hooks for Spambot module.
Code
function spambot_update_8004() {
$config = \Drupal::configFactory()
->getEditable('spambot.settings');
$whitelist_email = explode(PHP_EOL, $config
->get('spambot_whitelist_email'));
$whitelist_username = explode(PHP_EOL, $config
->get('spambot_whitelist_username'));
$whitelist_ip = explode(PHP_EOL, $config
->get('spambot_whitelist_ip'));
$config
->set('spambot_whitelist_email_list', array_map('trim', array_filter($whitelist_email)))
->set('spambot_whitelist_username_list', array_map('trim', array_filter($whitelist_username)))
->set('spambot_whitelist_ip_list', array_map('trim', array_filter($whitelist_ip)))
->save();
}