function statistics_advanced_update_6003 in Statistics Advanced 6
Convert ignore_roles variable into a permission.
File
- ./
statistics_advanced.install, line 85 - Install and uninstall schema and functions for the statistics_advanced module.
Code
function statistics_advanced_update_6003() {
$ret = array();
$perm = 'exclude visits from the access log';
$ignore_roles = variable_get('statistics_advanced_ignore_roles', array());
$ignore_roles = array_filter($ignore_roles, 'is_numeric');
if (!empty($ignore_roles)) {
$query = db_query("SELECT rid, perm FROM {permission} WHERE rid IN (" . db_placeholders($ignore_roles) . ") AND perm NOT LIKE '%%%s%%'", array_merge($ignore_roles, array(
$perm,
)));
while ($role = db_fetch_object($query)) {
$ret[] = update_sql("UPDATE {permission} SET perm = '{$role->perm}, {$perm}' WHERE rid = {$role->rid}");
}
}
variable_del('statistics_advanced_ignore_roles');
return $ret;
}