You are here

function hosting_site_insert in Hostmaster (Aegir) 6

Implementation of hook_insert().

1 call to hosting_site_insert()
hosting_site_update in modules/hosting/site/hosting_site.nodeapi.inc
Implementation of hook_update().

File

modules/hosting/site/hosting_site.nodeapi.inc, line 141
Site nodeapi implementations.

Code

function hosting_site_insert(&$node) {
  $client = hosting_get_client($node->client);
  $node->client = $client->nid;
  $node->site_language = $node->site_language ? $node->site_language : 'en';

  // If the cron_key is set use it, otherwise generate a new one.
  $node->cron_key = !empty($node->cron_key) ? $node->cron_key : '';

  // Ensure that the last_cron value is set.
  $node->last_cron = isset($node->last_cron) ? $node->last_cron : 0;
  hosting_ip_save($node, FALSE);
  db_query("INSERT INTO {hosting_site} (vid, nid, client, db_server, platform, profile, language, last_cron, cron_key, status, verified) VALUES (%d, %d, %d, %d, %d, %d, '%s', %d, '%s', %d, %d)", $node->vid, $node->nid, $node->client, $node->db_server, $node->platform, $node->profile, $node->site_language, $node->last_cron, $node->cron_key, $node->site_status, $node->verified);
  if (empty($node->old_vid)) {
    hosting_context_register($node->nid, $node->hosting_name ? $node->hosting_name : $node->title);
    if ($node->import) {
      hosting_add_task($node->nid, 'import');
    }
    else {
      hosting_add_task($node->nid, 'install');
    }
  }
}