You are here

public function DomainCommands::disable in Domain Access 8

Deactivates the domain.

@usage drush domain-disable example.com @usage drush domain-disable 1

@command domain:disable @aliases domain-disable

Parameters

string $domain_id: The numeric id or hostname of the domain to disable.

Return value

string Message to print.

Throws

\Drupal\domain\Commands\DomainCommandException

File

domain/src/Commands/DomainCommands.php, line 671

Class

DomainCommands
Drush commands for the domain module.

Namespace

Drupal\domain\Commands

Code

public function disable($domain_id) {

  // Resolve the domain.
  if ($domain = $this
    ->getDomainFromArgument($domain_id)) {
    if ($domain
      ->status()) {
      $domain
        ->disable();
      $this
        ->logger()
        ->info(dt('!domain has been disabled.', [
        '!domain' => $domain
          ->getHostname(),
      ]));
      return dt('Disabled !domain.', [
        '!domain' => $domain
          ->getHostname(),
      ]);
    }
    else {
      $this
        ->logger()
        ->info(dt('!domain is already disabled.', [
        '!domain' => $domain
          ->getHostname(),
      ]));
      return dt('!domain is already disabled.', [
        '!domain' => $domain
          ->getHostname(),
      ]);
    }
  }
  return dt('No matching domain record found.');
}