You are here

function webform_update_6309 in Webform 6.3

Fix permissions for all roles by adding an additional space after comma.

File

./webform.install, line 963
Webform module install/schema hooks.

Code

function webform_update_6309() {
  $ret = array();
  $result = db_query("SELECT r.rid, p.perm FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid");
  while ($role = db_fetch_object($result)) {
    $perms = explode(',', $role->perm);
    foreach ($perms as $id => $perm) {
      $perms[$id] = db_escape_string(trim($perm));
    }
    $ret[] = update_sql("UPDATE {permission} SET perm = '" . implode(', ', $perms) . "' WHERE rid = " . $role->rid);
  }
  return $ret;
}