You are here

function domain_features_rebuild in Domain Access 7.3

Implements hook_features_rebuild().

1 call to domain_features_rebuild()
domain_features_revert in ./domain.features.inc
Implements hook_features_revert().

File

./domain.features.inc, line 63
Features integration for Domain Access.

Code

function domain_features_rebuild($module) {
  if ($defaults = domain_features_load($module, 'domain_default_domains', TRUE)) {

    // Check for hard rebuild/revert.
    if ($wipe = domain_features_wipe_tables($defaults)) {
      $domains = domain_domains(TRUE);
      foreach ($domains as $domain) {
        if (!isset($defaults[$domain['machine_name']])) {
          domain_delete($domain);
        }
      }
      unset($defaults['wipe-domain-tables']);
    }

    // Save the domains in this feature.
    foreach ($defaults as $key => $domain) {
      if ($id = domain_load_domain_id($key)) {
        $domain['domain_id'] = $id;
      }
      domain_save($domain, $domain);
    }
  }
}