You are here

function hosting_site_drush_context_import in Hostmaster (Aegir) 6

File

modules/hosting/site/hosting_site.drush.inc, line 21

Code

function hosting_site_drush_context_import($context, &$node) {
  if ($context->type == 'site') {
    $node->title = strtolower(trim($context->uri));

    // force lowercase for existing uri
    $node->site_language = $context->language;
    $node->cron_key = $context->cron_key;
    $node->db_server = hosting_drush_import($context->db_server->name);
    $node->platform = hosting_drush_import($context->platform->name);

    // TODO: abstract this to remove duplication with import post hooks.
    $profile = hosting_package_instance_load(array(
      'i.rid' => $platform,
      'p.short_name' => $context->profile,
    ));
    if (!$profile) {
      $profile = hosting_package_instance_load(array(
        'i.rid' => $node->platform,
        'p.short_name' => 'default',
      ));
    }
    $node->profile = $profile->package_id;
    $client = node_load(HOSTING_DEFAULT_CLIENT);
    if ($context->client_name) {
      $client = hosting_import_client($context->client_name);
    }
    elseif ($context->client_email) {

      // @deprecated - drop this after 1.x
      $client = hosting_import_client($context->client_email);
    }
    $node->client = $client->nid;
  }
}