You are here

function workbench_access_update_7002 in Workbench Access 7

Use vocabulary machine names instead of ids.

NOTE: This update only affects sites on the pre-drupal.org release.

File

./workbench_access.install, line 293
Install file for Workbench Access.

Code

function workbench_access_update_7002() {
  if (!module_exists('taxonomy')) {
    return t('No update is required.');
  }
  $vocabularies = taxonomy_get_vocabularies();
  foreach ($vocabularies as $vid => $vocabulary) {
    db_update('workbench_access')
      ->fields(array(
      'access_type_id' => $vocabulary->machine_name,
    ))
      ->condition('access_type_id', $vocabulary->vid)
      ->execute();
  }
}