You are here

function book_access_update_7203 in Book access 7.2

Update the value of some Drupal variables used by the module.

File

./book_access.install, line 341

Code

function book_access_update_7203() {
  $grants = array(
    'view' => 'grant_view',
    'update' => 'grant_update',
    'delete' => 'grant_delete',
  );
  $variables = array(
    'book_access_default_authors_access',
    'book_access_default_roles_access',
    'book_access_default_users_access',
  );
  foreach ($variables as $variable) {
    $value = variable_get($variable, NULL);
    foreach ($grants as $old_value => $new_value) {
      if (!empty($value[$old_value])) {
        $value[$new_value] = $new_value;
      }
      unset($value[$old_value]);
    }
    variable_set($variable, $value);
  }
}