You are here

function comment_notify_update_6001 in Comment Notify 6

Permissions got renamed, update them.

File

./comment_notify.install, line 112
comment_notify.install.

Code

function comment_notify_update_6001() {
  $ret = array();
  $result = db_query("SELECT pid, perm FROM {permission}");
  while ($row = db_fetch_object($result)) {
    $permissions = explode(', ', $row->perm);
    if (in_array('Subscribe to comments', $permissions) && !in_array('subscribe to comments', $permissions)) {
      $permissions[] = 'subscribe to comments';
    }
    if (in_array('Administer comment notify', $permissions) && !in_array('administer comment notify', $permissions)) {
      $permissions[] = 'administer comment notify';
    }
    $permissions = implode(', ', $permissions);
    $ret[] = update_sql("UPDATE {permission} SET perm = '%s' WHERE pid = %d", $permissions, $row->pid);
  }
  return $ret;
}