You are here

function drush_domain_default in Domain Access 8

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

Sets the default domain id.

File

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

Code

function drush_domain_default($argument) {

  // Resolve the domain.
  if ($domain = drush_domain_get_from_argument($argument)) {
    $validate = drush_get_option('validate') ? 1 : 0;
    $domain
      ->addProperty('validate_url', $validate);
    if ($error = domain_drush_check_response($domain)) {
      drush_set_error('domain', $error);
    }
    else {
      $domain
        ->saveDefault();
      drush_print(dt('!domain set to primary domain.', [
        '!domain' => $domain
          ->getHostname(),
      ]));
    }
  }
}