You are here

function hosting_server_update in Hostmaster (Aegir) 6

Implementation of hook_update().

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

File

modules/hosting/server/hosting_server.module, line 315

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');
  }
}