Skip to content
Snippets Groups Projects
Commit 36e4c77f authored by catch's avatar catch
Browse files

Issue #1161486 by sun: Follow-up for move IP blocking into its own module.

parent 1f86ba60
No related branches found
No related tags found
No related merge requests found
......@@ -83,7 +83,7 @@ function ban_is_denied($ip) {
// Because this function is called on every page request, we first check
// for an array of IP addresses in settings.php before querying the
// database.
$blocked_ips = variable_get('blocked_ips');
$blocked_ips = variable_get('ban_ips');
if (isset($blocked_ips) && is_array($blocked_ips)) {
$denied = in_array($ip, $blocked_ips);
}
......@@ -148,7 +148,7 @@ function ban_action_info() {
*/
function ban_ip_action() {
$ip = ip_address();
db_insert('blocked_ips')
db_insert('ban_ip')
->fields(array('ip' => $ip))
->execute();
watchdog('action', 'Banned IP address %ip', array('%ip' => $ip));
......
......@@ -476,11 +476,10 @@
# );
/**
*
* IP blocking:
* IP blocking (Ban module).
*
* To bypass database queries for denied IP addresses, use this setting.
* Drupal queries the {blocked_ips} table by default on every page request
* Ban module queries the {ban_ip} table by default on every page request
* for both authenticated and anonymous users. This allows the system to
* block IP addresses from within the administrative interface and before any
* modules are loaded. However on high traffic websites you may want to avoid
......@@ -489,14 +488,11 @@
*
* If using this setting, you will need to add back any IP addresses which
* you may have blocked via the administrative interface. Each element of this
* array represents a blocked IP address. Uncommenting the array and leaving it
* empty will have the effect of disabling IP blocking on your site.
* array represents a blocked IP address.
*
* Remove the leading hash signs to enable.
*/
# $conf['blocked_ips'] = array(
# 'a.b.c.d',
# );
# $conf['ban_ips'][] = 'a.b.c.d';
/**
* Fast 404 pages:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment