function smart_ip_update_7006 in Smart IP 7.2
Update the admin debug mode to role based debug mode
File
- ./
smart_ip.install, line 240 - Installation callback for Smart IP.
Code
function smart_ip_update_7006() {
if (variable_get('smart_ip_debug', FALSE)) {
$debug_ip = variable_get('smart_ip_test_ip_address', ip_address());
$roles = user_roles();
$roles_debug = array();
$roles_debug_ip = array();
foreach ($roles as $role_id => $role) {
$role_permissions = user_role_permissions(array(
$role_id => $role_id,
));
if (isset($role_permissions[$role_id]['administer smart_ip']) && $role_permissions[$role_id]['administer smart_ip']) {
$roles_debug[$role_id] = $role_id;
}
$roles_debug_ip[$role_id] = $debug_ip;
}
variable_set('smart_ip_roles_in_debug_mode', $roles_debug);
variable_set('smart_ip_roles_in_debug_mode_ip', $roles_debug_ip);
}
variable_del('smart_ip_debug');
variable_del('smart_ip_test_ip_address');
}