You are here

function tac_lite_update_6001 in Taxonomy Access Control Lite 7

Same name and namespace in other branches
  1. 6 tac_lite.install \tac_lite_update_6001()

Rename permission from "administer_tac_lite" to "administer tac_lite" for UI consistency.

File

./tac_lite.install, line 84
Installation functions for tac_lite. TODO: All updates need proper error handling and responses

Code

function tac_lite_update_6001() {

  // TODO: Please review to make sure this is handling this update properly for this version of code. (only change was formatting and table name)
  $result = db_query("SELECT * FROM {role_permission} WHERE perm LIKE '%administer_tac_lite%'");
  foreach ($result as $permission) {
    $perm = str_replace('administer_tac_lite', 'administer tac_lite', $permission->perm);

    //db_query("UPDATE {permission} SET perm = '". db_escape_string($perm) ."' WHERE rid =". $permission->rid);
    $num_updated = db_update('permission')
      ->fields(array(
      'perm' => $perm,
    ))
      ->condition('rid', $permission->rid)
      ->execute();
  }
}