You are here

function drush_domain_default in Domain Access 7.3

Same name and namespace in other branches
  1. 8 domain/domain.drush.inc \drush_domain_default()

Set the default domain id.

File

./domain.drush.inc, line 393
Drush commands for Domain Access.

Code

function drush_domain_default($argument) {

  // Resolve the domain.
  if ($domain = drush_domain_get_from_argument($argument)) {
    $domains = array(
      $domain,
    );
  }
  else {
    return;
  }

  // Check for domain response.
  $check = drush_get_option('skip_check');
  if (empty($check)) {
    $error = domain_check_response($domain, TRUE);
    if ($error) {
      drush_set_error($error);
      drush_print(dt('You may disable this error by passing --skip_check=1.'));
      return;
    }
  }
  $domain['is_default'] = 1;
  domain_save($domain, $domain);
  drush_print(dt('!domain set to primary domain.', array(
    '!domain' => $domain['subdomain'],
  )));
}