You are here

function hosting_site_drush_context_import in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 site/hosting_site.drush.inc \hosting_site_drush_context_import()
  2. 7.3 site/hosting_site.drush.inc \hosting_site_drush_context_import()

File

site/hosting_site.drush.inc, line 19

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' => $node->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);
    }
    $node->client = $client->nid;
  }
}