You are here

smart_ip_maxmind_geoip2_bin_db.install in Smart IP 8.3

File

modules/smart_ip_maxmind_geoip2_bin_db/smart_ip_maxmind_geoip2_bin_db.install
View source
<?php

use Drupal\Core\Link;
use Drupal\Core\Url;

/**
 * Implements hook_requirements().
 */
function smart_ip_maxmind_geoip2_bin_db_requirements($phase) {
  $requirements = [];
  if ($phase == 'install') {
    if (!class_exists('\\GeoIp2\\Database\\Reader')) {
      $requirements['geoip2_library'] = [
        'description' => t('Smart IP MaxMind GeoIP2 binary database module requires the
          geoip2/geoip2 library. To setup, follow this @guide', [
          '@guide' => Link::fromTextAndUrl(t('guide'), Url::fromUri('https://www.webfoobar.com/node/71'))
            ->toString(),
        ]),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }
  return $requirements;
}

/**
 * Implements hook_uninstall().
 */
function smart_ip_maxmind_geoip2_bin_db_uninstall() {

  // Remove all stored states
  \Drupal::state()
    ->deleteMultiple([
    'smart_ip_maxmind_geoip2_bin_db.last_update_time',
  ]);
}