You are here

function image_update_6103 in Image 6

Same name and namespace in other branches
  1. 7 image.install \image_update_6103()

Rename permission "edit images" to "edit any images".

File

./image.install, line 360

Code

function image_update_6103() {
  $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(
      'edit images' => 'edit any images, delete any images',
      'edit own images' => 'edit own images, delete own images',
    ));
    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;
}