Function __global->add_ip_ban
Definitions
sources/failure.php
- Add an IP-ban.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: bool
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $ip | IP | No | No | required parameter | N/A | N/A | The IP address to ban (potentially encoded with *'s) |
| $descrip | LONG_TEXT | No | No | Blank (empty string) | N/A | N/A | Explanation for ban |
| $ban_until | ?TIME | No | No | Null | N/A | N/A | When to ban until (null: no limit) |
| $ban_positive | boolean | No | No | True | N/A | N/A | Whether this is actually a ban (as opposed to a cached negative "not-banned") |
| $force_ban | boolean | No | No | False | N/A | N/A | Whether to force the ban to take place even if the IP address is on a spam exclusion or has a negative ban |
| $check_caching | boolean | No | No | True | N/A | N/A | Whether to check internal run-time caching (disable if doing automated tests) |
Returns
- Whether a change actually happened
- Type: boolean
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Add an IP-ban.
*
* @param IP $ip The IP address to ban (potentially encoded with *'s)
* @param LONG_TEXT $descrip Explanation for ban
* @param ?TIME $ban_until When to ban until (null: no limit)
* @param boolean $ban_positive Whether this is actually a ban (as opposed to a cached negative "not-banned")
* @param boolean $force_ban Whether to force the ban to take place even if the IP address is on a spam exclusion or has a negative ban
* @param boolean $check_caching Whether to check internal run-time caching (disable if doing automated tests)
* @return boolean Whether a change actually happened
*/
function add_ip_ban(string $ip, string $descrip = '', ?int $ban_until = null, bool $ban_positive = true, bool $force_ban = false, bool $check_caching = true) : bool
* Add an IP-ban.
*
* @param IP $ip The IP address to ban (potentially encoded with *'s)
* @param LONG_TEXT $descrip Explanation for ban
* @param ?TIME $ban_until When to ban until (null: no limit)
* @param boolean $ban_positive Whether this is actually a ban (as opposed to a cached negative "not-banned")
* @param boolean $force_ban Whether to force the ban to take place even if the IP address is on a spam exclusion or has a negative ban
* @param boolean $check_caching Whether to check internal run-time caching (disable if doing automated tests)
* @return boolean Whether a change actually happened
*/
function add_ip_ban(string $ip, string $descrip = '', ?int $ban_until = null, bool $ban_positive = true, bool $force_ban = false, bool $check_caching = true) : bool

