You are here

function hosting_server_insert in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 server/hosting_server.module \hosting_server_insert()
  2. 7.3 server/hosting_server.module \hosting_server_insert()

Implements hook_insert().

1 call to hosting_server_insert()
hosting_server_update in server/hosting_server.module
Implements hook_update().

File

server/hosting_server.module, line 571

Code

function hosting_server_insert($node) {

  // Always generate a new context.
  $hosting_name = isset($node->hosting_name) ? $node->hosting_name : 'server_' . preg_replace("/[!\\W\\.\\-]/", "", $node->title);
  hosting_context_register($node->nid, $hosting_name);
  $id = db_insert('hosting_server')
    ->fields(array(
    'vid' => $node->vid,
    'nid' => $node->nid,
    'human_name' => isset($node->human_name) ? $node->human_name : '',
    'verified' => isset($node->verified) ? $node->verified : 0,
    'status' => isset($node->platform_status) ? $node->platform_status : 0,
  ))
    ->execute();
  _hosting_ip_save($node);
  hosting_server_invoke_services($node, 'save', $node);
  hosting_server_invoke_services($node, 'insert', $node);
  if (empty($node->no_verify)) {
    hosting_add_task($node->nid, 'verify');
  }
}