function hosting_task_update in Hosting 5
Same name and namespace in other branches
- 6.2 task/hosting_task.module \hosting_task_update()
- 7.4 task/hosting_task.module \hosting_task_update()
- 7.3 task/hosting_task.module \hosting_task_update()
Implementation of hook_update().
As an existing node is being updated in the database, we need to do our own database updates.
File
- task/
hosting_task.module, line 219 - 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 ($node->revision) {
hosting_task_insert($node);
}
else {
hosting_task_set_title($node);
db_query("UPDATE {hosting_task} SET nid=%d, task_type = '%s', rid = %d, executed=%d, task_status=%d WHERE vid=%d", $node->nid, $node->task_type, $node->rid, $node->executed, $node->task_status, $node->vid);
db_query("UPDATE {hosting_task_queue} SET status=%d WHERE nid=%d", $node->queued, $node->nid);
if (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);
}
}
}
}