You are here

class FloodUnblockCommands in Flood Unblock 8.2

Same name and namespace in other branches
  1. 8 src/Commands/FloodUnblockCommands.php \Drupal\flood_unblock\Commands\FloodUnblockCommands

Flood unblock. module's Drush 9 commands.

Hierarchy

Expanded class hierarchy of FloodUnblockCommands

1 string reference to 'FloodUnblockCommands'
drush.services.yml in ./drush.services.yml
drush.services.yml
1 service uses FloodUnblockCommands
flood_unblock.commands in ./drush.services.yml
\Drupal\flood_unblock\Commands\FloodUnblockCommands

File

src/Commands/FloodUnblockCommands.php, line 11

Namespace

Drupal\flood_unblock\Commands
View source
class FloodUnblockCommands extends DrushCommands {

  /**
   * @var FloodUnblockManager
   */
  private $manager;

  /**
   * FloodUnblockCommands constructor.
   *
   * @param \Drupal\flood_unblock\FloodUnblockManager $manager
   */
  public function __construct(FloodUnblockManager $manager) {
    $this->manager = $manager;
  }

  /**
   * Clears the floods based on IP.
   *
   * @param string $ip
   *   IP to clear.
   *
   * @command flood_unblock:ip
   * @usage flood_unblock:ip
   */
  public function unblockIp($ip = NULL) {
    $this->manager
      ->flood_unblock_clear_event('user.failed_login_ip', $ip);
    $this
      ->output()
      ->writeln('Done');
  }

  /**
   * Clears the floods based on user.
   *
   * @param string $user
   *   User to clear...
   *
   * @command flood_unblock:user
   * @usage flood_unblock:user
   */
  public function unblockUser($user = NULL) {
    $this->manager
      ->flood_unblock_clear_event('user.failed_login_user', $user);
    $this
      ->output()
      ->writeln('Done');
  }

  /**
   * Clears all floods in the system.
   *
   * @command flood_unblock:all
   * @usage flood_unblock:all
   */
  public function unblockAll() {
    $this->manager
      ->flood_unblock_clear_event('user.failed_login_ip', NULL);
    $this->manager
      ->flood_unblock_clear_event('user.failed_login_user', NULL);
    $this->manager
      ->flood_unblock_clear_event('user.http_login', NULL);
    $this
      ->output()
      ->writeln('Done');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FloodUnblockCommands::$manager private property
FloodUnblockCommands::unblockAll public function Clears all floods in the system.
FloodUnblockCommands::unblockIp public function Clears the floods based on IP.
FloodUnblockCommands::unblockUser public function Clears the floods based on user.
FloodUnblockCommands::__construct public function FloodUnblockCommands constructor.