You are here

domain.drush.inc in Domain Access 7.2

Same filename and directory in other branches
  1. 6.2 domain.drush.inc
  2. 7.3 domain.drush.inc

Drush commands for Domain Access.

File

domain.drush.inc
View source
<?php

/**
 * @file
 * Drush commands for Domain Access.
 */

/**
 * Implements hook_drush_command().
 */
function domain_drush_command() {
  $items = array();
  $items['domain-list'] = array(
    'description' => 'List active domains for the site.',
  );
  return $items;
}

/**
 * Implements hook_drush_help().
 */
function domain_drush_help($section) {
  $items = domain_drush_command();
  $name = str_replace('domain:', '', $section);
  if (isset($items[$name])) {
    return dt($items[$name]['description']);
  }
}

/**
 * Show the domain list.
 */
function drush_domain_list() {
  $domains = domain_domains();
  $header = array(
    'sitename' => dt('sitename'),
    'subdomain' => dt('domain'),
    'scheme' => dt('scheme'),
    'valid' => dt('active'),
    'domain_id' => dt('domain_id'),
  );
  $rows = array(
    array_values($header),
  );
  foreach ($domains as $domain) {
    $row = array();
    foreach ($header as $key => $name) {
      $row[] = check_plain($domain[$key]);
    }
    $rows[] = $row;
  }
  drush_print_table($rows, TRUE);
}

Functions

Namesort descending Description
domain_drush_command Implements hook_drush_command().
domain_drush_help Implements hook_drush_help().
drush_domain_list Show the domain list.