You are here

public function DomainCommands::enable in Domain Access 8

Activates the domain.

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

@command domain:enable @aliases domain-enable

Parameters

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

Return value

string The message to print.

Throws

\Drupal\domain\Commands\DomainCommandException

File

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

Class

DomainCommands
Drush commands for the domain module.

Namespace

Drupal\domain\Commands

Code

public function enable($domain_id) {

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