You are here

function hosting_server_update in Hosting 6.2

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

Implementation of hook_update().

As an existing node is being updated in the database, we need to do our own database updates.

File

server/hosting_server.module, line 353

Code

function hosting_server_update($node) {

  // if this is a new node or we're adding a new revision,
  if (!empty($node->revision)) {
    hosting_server_insert($node);
  }
  else {
    hosting_server_invoke_services($node, 'save', $node);
    hosting_server_invoke_services($node, 'update', $node);

    // Remove disabled services
    foreach (array_diff(array_keys(hosting_server_services()), array_keys($node->services)) as $name) {
      db_query("DELETE FROM {hosting_service} WHERE service = '%s' AND nid = %d", $name, $node->nid);
    }
  }
  hosting_ip_save($node, TRUE);
  if (!$node->no_verify) {
    hosting_add_task($node->nid, 'verify');
  }
}