function hosting_task_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/ task/ hosting_task.module, line 591 - Web server node type is defined here.
Code
function hosting_task_update($node) {
// if this is a new node or we're adding a new revision,
if (!empty($node->revision)) {
hosting_task_insert($node);
}
else {
hosting_task_set_title($node);
db_query("UPDATE {hosting_task} SET nid=%d, task_type = '%s', task_status = %d, rid = %d, executed=%d, delta=%d WHERE vid=%d", $node->nid, $node->task_type, $node->task_status, $node->rid, $node->executed, $node->delta, $node->vid);
if (isset($node->task_args) && is_array($node->task_args)) {
# Wipe out old arguments first, since arguments could theoretically be removed.
db_query("DELETE FROM {hosting_task_arguments} WHERE vid=%d", $node->vid);
foreach ($node->task_args as $key => $value) {
db_query("INSERT INTO {hosting_task_arguments} (vid, nid, name, value) VALUES (%d, %d, '%s', '%s')", $node->vid, $node->nid, $key, $value);
}
}
}
}