You are here

function hosting_task_insert in Hosting 5

Same name and namespace in other branches
  1. 6.2 task/hosting_task.module \hosting_task_insert()
  2. 7.4 task/hosting_task.module \hosting_task_insert()
  3. 7.3 task/hosting_task.module \hosting_task_insert()

Implementation of hook_insert().

1 call to hosting_task_insert()
hosting_task_update in task/hosting_task.module
Implementation of hook_update().

File

task/hosting_task.module, line 194
Web server node type is defined here.

Code

function hosting_task_insert($node) {
  db_query("INSERT INTO {hosting_task} (vid, nid, task_type, rid, executed, task_status) VALUES (%d, %d, '%s', %d, %d, %d)", $node->vid, $node->nid, $node->task_type, $node->rid, $node->executed, $node->task_status);
  if (is_array($node->task_args)) {
    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);
    }
  }
  hosting_task_set_title($node);
  if ($node->is_new) {
    db_query("INSERT INTO {hosting_task_queue} (nid, timestamp, status) VALUES (%d, %d, %d)", $node->nid, mktime(), 1);
  }
  else {
    db_query("UPDATE {hosting_task_queue} SET status = %d WHERE nid=%d", $node->queued, $node->nid);
  }
}