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

Issue #1559780 by sun: Fixed Remove ban_ip_action() from core. It blocks the...

Issue #1559780 by sun: Fixed Remove ban_ip_action() from core. It blocks the currently logged-in user. (and potentially, your entire team).
parent 198846a8
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -71,30 +71,3 @@ function ban_menu() {
function ban_ip_load($iid) {
return db_query("SELECT * FROM {ban_ip} WHERE iid = :iid", array(':iid' => $iid))->fetchAssoc();
}
/**
* Implements hook_action_info().
*/
function ban_action_info() {
return array(
'ban_ip_action' => array(
'type' => 'user',
'label' => t('Ban IP address of current user'),
'configurable' => FALSE,
'triggers' => array('any'),
),
);
}
/**
* Bans the current user's IP address.
*
* @ingroup actions
*/
function ban_ip_action() {
$ip = ip_address();
db_insert('ban_ip')
->fields(array('ip' => $ip))
->execute();
watchdog('action', 'Banned IP address %ip', array('%ip' => $ip));
}
......@@ -1934,14 +1934,11 @@ function system_update_8020() {
->execute();
// Rename {blocked_ips} table into {ban_ip}.
db_rename_table('blocked_ips', 'ban_ip');
// Rename all references to the action callback.
db_update('actions')
->fields(array('callback' => 'ban_ip_action'))
// Remove all references to the removed action callback.
db_delete('actions')
->condition('callback', 'system_block_ip_action')
->execute();
// Rename the action's aid.
db_update('actions')
->fields(array('aid' => 'ban_ip_action'))
db_delete('actions')
->condition('aid', 'system_block_ip_action')
->execute();
// Enable the new Ban module.
......
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