You are here

function domain_update_7309 in Domain Access 7.3

Updates domain_roles variable to use machine names.

File

./domain.install, line 408
Install file.

Code

function domain_update_7309(&$sandbox) {
  drupal_load('module', 'domain');
  $defaults = variable_get('domain_roles', array());
  $new = array();
  foreach ($defaults as $rid => $domains) {

    // We cannot use a constant here. See https://drupal.org/node/2042461.
    $new[$rid]['DOMAIN_ALL'] = $domains['all'];
    foreach ($domains as $domain_id => $check) {
      $domain = domain_lookup($domain_id);
      if ($domain != -1) {
        $new[$rid][$domain['machine_name']] = $check;
      }
    }
  }
  variable_set('domain_roles', $new);
}