You are here

function gmap_location_update_5102 in GMap Module 6.2

Same name and namespace in other branches
  1. 5 gmap_location.install \gmap_location_update_5102()
  2. 6 gmap_location.install \gmap_location_update_5102()
  3. 7.2 gmap_location.install \gmap_location_update_5102()
  4. 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 178
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;
}