function hosting_task_update in Hosting 6.2
Same name and namespace in other branches
- 5 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 622 - 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);
}
}
}
}