You are here

function addanother_update_2 in Add Another 7

Same name and namespace in other branches
  1. 6 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 37
Install, update and uninstall functions for the 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;
}