function hosting_server_update in Hosting 7.4
Same name and namespace in other branches
- 6.2 server/hosting_server.module \hosting_server_update()
- 7.3 server/hosting_server.module \hosting_server_update()
Implements 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 530
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_delete('hosting_service')
->condition('service', $name)
->condition('nid', $node->nid)
->execute();
}
}
if ($node->server_status == HOSTING_SERVER_DELETED) {
$node->no_verify = TRUE;
}
$id = db_update('hosting_server')
->fields(array(
'human_name' => $node->human_name,
'verified' => $node->verified,
'status' => $node->server_status,
))
->condition('nid', $node->nid)
->execute();
_hosting_ip_save($node);
if (empty($node->no_verify)) {
hosting_add_task($node->nid, 'verify');
}
}