You are here

function smart_ip_ip2location_bin_db_update_8301 in Smart IP 8.3

Same name and namespace in other branches
  1. 8.4 modules/smart_ip_ip2location_bin_db/smart_ip_ip2location_bin_db.install \smart_ip_ip2location_bin_db_update_8301()

Merge the two separate custom paths for IPV4 and IPV6 binary files into one path. Change the default value of db_auto_update to FALSE.

File

modules/smart_ip_ip2location_bin_db/smart_ip_ip2location_bin_db.install, line 45

Code

function smart_ip_ip2location_bin_db_update_8301() {
  $configName = \Drupal\smart_ip_ip2location_bin_db\EventSubscriber\SmartIpEventSubscriber::configName();
  $config = \Drupal::configFactory()
    ->getEditable($configName);
  $filesystem = \Drupal::service('file_system');
  $path = $filesystem
    ->dirname($config
    ->get('ip2location_bin_db_ipv4_custom_path'));
  $config
    ->set('db_auto_update', '0')
    ->set('bin_file_custom_path', $path)
    ->clear('ip2location_bin_db_ipv4_custom_path')
    ->clear('ip2location_bin_db_ipv6_custom_path')
    ->save();
}