protected function BanIp::doExecute in Rules 8.3
Executes the BanIP action with the given context.
Parameters
string $ip: (optional) The IP address that should be banned.
File
- src/
Plugin/ RulesAction/ BanIp.php, line 35
Class
- BanIp
- Provides the 'Ban IP' action.
Namespace
Drupal\rules\Plugin\RulesActionCode
protected function doExecute($ip = NULL) {
if (!isset($ip)) {
$ip = $this->requestStack
->getCurrentRequest()
->getClientIp();
}
$this->banManager
->banIp($ip);
$this->logger
->notice('Banned IP address %ip', [
'%ip' => $ip,
]);
}