You are here

public function MigrateDestinationDomain::rollback in Domain Access 7.3

Delete a single domain.

Parameters

$id: Array of fields representing the key (in this case, just domain_name).

File

./domain.migrate.inc, line 177
Support for domains in core Drupal objects

Class

MigrateDestinationDomain
Migration class for importing domains into Drupal.

Code

public function rollback(array $id) {
  $domain_name = reset($id);
  migrate_instrument_start('domain_delete');
  $this
    ->prepareRollback($domain_name);
  if ($domain = domain_machine_name_load($domain_name)) {

    // We cannot delete the primary domain.
    $default = domain_default_id();
    if ($domain['domain_id'] != $default) {
      domain_delete($domain);
    }
    else {
      drupal_set_message(t('The default domain may not be rolled back.'), 'status', FALSE);
    }
  }
  $this
    ->completeRollback($domain_name);
  migrate_instrument_stop('domain_delete');
}