You are here

protected function UnBanIp::doExecute in Rules 8.3

Executes the UnBanIP action with the given context.

Parameters

string $ip: (optional) The IP address for which the ban should be removed.

File

src/Plugin/RulesAction/UnBanIp.php, line 35

Class

UnBanIp
Provides the 'Remove the ban on an IP address' action.

Namespace

Drupal\rules\Plugin\RulesAction

Code

protected function doExecute($ip = NULL) {
  if (!isset($ip)) {
    $ip = $this->requestStack
      ->getCurrentRequest()
      ->getClientIp();
  }
  $this->banManager
    ->unbanIp($ip);
  $this->logger
    ->notice('Removed ban on IP address %ip', [
    '%ip' => $ip,
  ]);
}