You are here

function image_gallery_update_6100 in Image 7

Same name and namespace in other branches
  1. 6 contrib/image_gallery/image_gallery.install \image_gallery_update_6100()

Rename permission "administer images" to "administer image galleries".

File

contrib/image_gallery/image_gallery.install, line 74

Code

function image_gallery_update_6100() {
  $ret = array();
  $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
  while ($role = db_fetch_object($result)) {
    $renamed_permission = strtr($role->perm, array(
      'administer images' => 'administer image galleries',
    ));
    if ($renamed_permission != $role->perm) {
      $args = array(
        $renamed_permission,
        $role->rid,
      );
      $query = "UPDATE {permission} SET perm = '%s' WHERE rid = %d";
      _db_query_callback($args, TRUE);
      $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
      $ret[] = update_sql($query);
    }
  }
  return $ret;
}