function hosting_add_task

7.x-3.x hosting_task.module hosting_add_task($nid, $type, $args = NULL, $status = HOSTING_TASK_QUEUED)

Helper function to generate new task node

33 calls to hosting_add_task()
drush_hosting_task_validate in ./
Validate hook for the hosting-task Drush command.
hook_hosting_TASK_TYPE_task_rollback in ./hosting.api.php
Perform actions when a task has failed and has been rolled back.
hosting_alias_update_6204 in alias/hosting_alias.install
Fixup redirection data after table change in hosting_alias_update_6203()
hosting_feature_rebuild_caches in ./
Perform necessary task after enabling or disabling Hosting features.
hosting_migrate_platform_submit in migrate/
Implements hook_submit().

... See full list


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


function hosting_add_task($nid, $type, $args = NULL, $status = HOSTING_TASK_QUEUED) {
  global $user;

  // Guard against destructive tasks run on guarded nodes.
  if (!hosting_task_dangerous_task_is_allowed($type, $nid)) {
    return FALSE;

  $node = db_query("SELECT nid, uid, title FROM {node} WHERE nid = :nid", array(':nid' => $nid))->fetchObject();

  $task = new stdClass();
  $task->language = LANGUAGE_NONE;
  $task->type = 'task';
  # TODO: make this pretty
  $task->title = t("!type !title", array('!type' => $type, '!title' => $node->title));
  $task->task_type = $type;
  $task->rid = $node->nid;
   * fallback the owner of the task to the owner of the node we operate
   * upon
   * this is mostly for the signup form, which runs as the anonymous
   * user, but for which the node is set to the right user
  $task->uid = $user->uid ? $user->uid : $node->uid;
  $task->status = 1;
  $task->task_status = $status;
  if ($status == HOSTING_TASK_QUEUED) {
    $task->revision = TRUE;
  #arguments, such as which backup to restore.
  if (is_array($args)) {
    $task->task_args = $args;
  return $task;