You are here

function addanother_update_2 in Add Another 6

Same name and namespace in other branches
  1. 7 addanother.install \addanother_update_2()

Update permission name to 'use add another' instead of 'enable add another' to improve usability/consistency.

File

./addanother.install, line 36
Uninstall and update routines for Add another module.

Code

function addanother_update_2() {
  $ret = array();
  $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
  while ($role = db_fetch_object($result)) {
    $renamed_permission = preg_replace('/enable add another/', 'use add another', $role->perm);
    if ($renamed_permission != $role->perm) {
      $ret[] = update_sql("UPDATE {permission} SET perm = '{$renamed_permission}' WHERE rid = {$role->rid}");
    }
  }
  return $ret;
}