function gmap_location_update_5102 in GMap Module 6
Same name and namespace in other branches
- 5 gmap_location.install \gmap_location_update_5102()
- 6.2 gmap_location.install \gmap_location_update_5102()
- 7.2 gmap_location.install \gmap_location_update_5102()
- 7 gmap_location.install \gmap_location_update_5102()
5.x-1.1 update 1 (Still haven't diverged for 6.x.) #392130: Use better permission names.
File
- ./
gmap_location.install, line 170 - gmap_location install routines.
Code
function gmap_location_update_5102() {
$ret = array();
$result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
while ($role = db_fetch_object($result)) {
$renamed_permission = preg_replace('/(?<=^|,\\ )user\\ locations(?=,|$)/', 'view user location details', $role->perm);
$renamed_permission = preg_replace('/(?<=^|,\\ )show\\ user\\ map(?=,|$)/', 'view user map', $renamed_permission);
$renamed_permission = preg_replace('/(?<=^|,\\ )show\\ node\\ map(?=,|$)/', 'view node map', $renamed_permission);
if ($renamed_permission != $role->perm) {
$ret[] = update_sql("UPDATE {permission} SET perm = '{$renamed_permission}' WHERE rid = {$role->rid}");
}
}
return $ret;
}