You are here

function httpbl_drush_command in http:BL 8

Implements hook_drush_command().

File

drush/httpbl.drush.inc, line 15
Drush integration for the httpbl module.

Code

function httpbl_drush_command() {
  $items['httpbl-sos'] = array(
    'description' => 'Unbans and white-lists an IP address, with an option to stop http:BL checking/blocking of all page requests. Use in emergencies if an admin locks out localhost while testing httpbl module. Easily used with only the options to control httpbl checking.',
    'arguments' => array(
      'ip' => 'IP address to unban (e.g. "127.0.0.1" for localhost).  Localhost is the default.',
    ),
    'options' => array(
      'stop' => 'Stops http:BL checking/blocking of all page requests.',
      'start' => 'Start http:BL checking/blocking of all page requests (no harm done if it\'s already running).',
      'comment' => 'Start http:BL checking/blocking on comment submissions only.',
    ),
    'examples' => array(
      'httpbl-sos (or drush sos)' => 'Unban and white-list localhost by default.',
      'httpbl-sos --stop' => 'Unban and white-list localhost by default, and stop checking/blocking of all page requests.',
      'httpbl-sos 127.0.0.1' => 'Unban and white-list (any) specified ip address.',
      'httpbl-sos 127.0.0.1 --stop' => 'Same as above and stop checking/blocking of all page requests.',
      'httpbl-sos 127.0.0.1 --start' => 'Unban and white-list (any) specified ip address and start checking/blocking of all page requests.',
      'drush sos --comment' => 'Start checking on comment submissions only, and unban/white-list localhost if needed.',
    ),
    'required-arguments' => 0,
    'aliases' => [
      'sos',
    ],
  );
  $items['httpbl-mho'] = array(
    'description' => 'Quickly make up to 255 evaluated hosts of a certain status and expire time. (Hint: use this to test httpbl cron)',
    'arguments' => array(
      'max' => 'The number of hosts to be generated. Default is 255.',
      'status' => 'The status (0=safe, 1=blackisted, 2=grey-listed). Default is 0.',
      'offset' => 'The time from now the host should expire. Default is 300.',
      'pattern' => 'The pattern used for IP addresses.  Default is "127.0.1.".',
    ),
    'examples' => array(
      'httpbl-mho (or drush mho)' => 'Use defaults and create 255 safe hosts that expire in 5 minutes.',
      'drush mho 50 2 60' => 'Make 50 grey-listed hosts that expire in 1 minute.',
      'drush mho 25 1 60 129.0.1.' => 'Make 25 blacklisted hosts that expire in 1 minute, starting with 129.0.1.1.',
    ),
    'required-arguments' => 0,
    'aliases' => [
      'mho',
    ],
  );
  $items['httpbl-mbb'] = array(
    'description' => 'Quickly make up to 255 blacklisted and banned hosts of a certain expire time (Hint: use this to test httpbl cron)',
    'arguments' => array(
      'max' => 'The number of hosts to be generated. Default is 255.',
      'offset' => 'The time from now the host should expire. Default is 300.',
      'pattern' => 'The pattern used for IP addresses.  Default is "127.1.8.".',
    ),
    'examples' => array(
      'httpbl-mbb (or drush mbb)' => 'Use defaults and create 255 blacklisted and banned hosts that expire in 5 minutes.',
      'drush mbb 50 60' => 'Make 50 blacklisted and banned hosts that expire in 1 minute.',
      'drush mbb 25 60 129.0.1.' => 'Make 25 blacklisted and banned hosts that expire in 1 minute, starting with 129.0.1.1.',
    ),
    'required-arguments' => 0,
    'aliases' => [
      'mbb',
    ],
  );
  $items['httpbl-sol'] = array(
    'description' => 'Remove localhost or another testing ip from hosts.',
    'arguments' => array(
      'ip' => 'IP address to remove (e.g. "127.0.0.1" for localhost).  Localhost is the default.',
    ),
    'examples' => array(
      'httpbl-sol (or drush sol)' => 'Remove localhost from host.',
      'drush sol 127.0.0.1' => 'Remove specific ip from host.',
    ),
    'required-arguments' => 0,
    'aliases' => [
      'sol',
    ],
  );
  return $items;
}