function module_grants_update_6207 in Module Grants 6.4
Same name and namespace in other branches
- 6.3 module_grants.install \module_grants_update_6207()
Rename permissions. Core doesn't support apostrophes so strip these out and capitalise the permission name for readibility. See [#566290], [#572804].
File
- ./
module_grants.install, line 55 - Install and uninstall hooks for Module Grants module
Code
function module_grants_update_6207() {
$ret = array();
// permission.perm column contains a comma-separated string of permissions
$result = db_query("SELECT rid,perm FROM {permission} WHERE perm LIKE '%access \\'%\\' tab%'");
while ($permissions = db_fetch_object($result)) {
$sanitized_permissions = preg_replace("/access \\'([A-Z a-z]+)\\' tab/e", "'access '. ucwords('\$1') .' tab'", $permissions->perm);
$ret[] = update_sql("UPDATE {permission} SET perm='" . db_escape_string($sanitized_permissions) . "' WHERE rid={$permissions->rid}");
}
return $ret;
}