You are here

function blocked_ips_expire_requirements in Blocked IPs Expire 7

Implements hook_requirements().

File

./blocked_ips_expire.install, line 11
Install, update, and uninstall functions for the blocked_ips_expire module.

Code

function blocked_ips_expire_requirements($phase) {
  $requirements = array();
  $t = get_t();

  // Report IP addresses with unassigned expiry dates at runtime only.
  if ($phase === 'runtime') {
    $ips_without_expiry_dates = _blocked_ips_expire_get_unassigned(TRUE);
    if ($ips_without_expiry_dates > 0) {
      $requirements['blocked_ips_expire'] = array(
        'title' => $t('Blocked IP expiry'),
        'severity' => REQUIREMENT_WARNING,
        'value' => format_plural($ips_without_expiry_dates, 'An IP address has not been given an expiry date.', '@count IP addresses have not been given expiry dates.'),
        'description' => $t("Blocked IP addresses without expiry dates will never be unblocked, meaning potentially-legitimate visitors who previously had a virus or took over an IP address that used to belong to a spammer will never be able to access your site. Visit <a href='@bulk_assign_url'>the bulk assignment page</a> to assign expiry dates to blocked IP addresses that don't have them.", array(
          '@bulk_assign_url' => base_path() . 'admin/config/people/blocked_ips_expire/bulk_assign',
        )),
      );
    }
  }
  return $requirements;
}