You are here

public static function BlockedIpsExpireTestCase::getExpiryTime in Blocked IPs Expire 7

Return the expiry time of an IP address in the database.

Parameters

string $ip: The IP address to check.

Return value

int The expiry time, in UNIX time.

File

tests/blocked_ips_expire.base.test, line 69
Contains \BlockedIpsExpireTestCase.

Class

BlockedIpsExpireTestCase
An object containing test functions common to all tests for this module.

Code

public static function getExpiryTime($ip) {
  $query = db_select('blocked_ips', 'bi');
  $query
    ->join('blocked_ips_expire', 'bie', 'bi.iid = bie.iid');
  $query
    ->addField('bie', 'expiry_date');
  $query
    ->condition('bi.ip', $ip, '=');
  $result = $query
    ->execute()
    ->fetchField();
  return $result;
}