You are here

function fail2ban_update_7200 in Fail2ban Firewall Integration 7.2

Implements hook_update_N().

Remove all module preferences except for the log string and tweak the module weight.

File

./fail2ban.install, line 62

Code

function fail2ban_update_7200() {
  $settings = variable_get('fail2ban', array(
    'logstring' => '',
  ));
  variable_set('fail2ban_logstring', $settings['logstring']);
  variable_del('fail2ban');

  // Ensure the module weight is hgher than the syslog module weight.
  $weight = db_query('SELECT weight FROM {system} WHERE name = :name', array(
    ':name' => 'syslog',
  ))
    ->fetchField();
  db_query('UPDATE {system} SET weight = :weight WHERE name = :name', array(
    ':weight' => ++$weight,
    ':name' => 'fail2ban',
  ));
}