function simplenews_update_6007 in Simplenews 6.2
Same name and namespace in other branches
- 6 simplenews.install \simplenews_update_6007()
Rename old permissions.
File
- ./
simplenews.install, line 678 - Simplenews installation.
Code
function simplenews_update_6007() {
$ret = array();
$result = db_query("\n SELECT rid, perm\n FROM {permission}\n ORDER BY rid");
while ($role = db_fetch_object($result)) {
$patterns = array(
'/create newsletter/',
'/edit own newsletter/',
'/edit any newsletter/',
'/delete own newsletter/',
'/delete any newsletter/',
);
$replacements = array(
'create simplenews content',
'edit own simplenews content',
'edit any simplenews content',
'delete own simplenews content',
'delete any simplenews content',
);
$renamed_permission = preg_replace($patterns, $replacements, $role->perm);
if ($renamed_permission != $role->perm) {
$ret[] = update_sql("\n UPDATE {permission}\n SET perm = '{$renamed_permission}'\n WHERE rid = {$role->rid}");
}
}
return $ret;
}