You are here

function hosting_task_insert in Hosting 7.3

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

Implements hook_insert().

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

File

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

Code

function hosting_task_insert($node) {
  $node->executed = isset($node->executed) ? $node->executed : NULL;
  $node->delta = isset($node->delta) ? $node->delta : NULL;
  $id = db_insert('hosting_task')
    ->fields(array(
    'vid' => $node->vid,
    'nid' => $node->nid,
    'task_type' => $node->task_type,
    'task_status' => $node->task_status,
    'rid' => $node->rid,
    'executed' => $node->executed,
    'delta' => $node->delta,
  ))
    ->execute();
  if (isset($node->task_args) && is_array($node->task_args)) {
    foreach ($node->task_args as $key => $value) {
      $id = db_insert('hosting_task_arguments')
        ->fields(array(
        'vid' => $node->vid,
        'nid' => $node->nid,
        'name' => $key,
        'value' => $value,
      ))
        ->execute();
    }
  }
  module_invoke_all('hosting_task_update_status', $node, $node->task_status);
  hosting_task_set_title($node);
}