function hosting_add_task in Hosting 5
Same name and namespace in other branches
- 6.2 task/hosting_task.module \hosting_add_task()
- 7.4 task/hosting_task.module \hosting_add_task()
- 7.3 task/hosting_task.module \hosting_add_task()
Helper function to generate new task node
9 calls to hosting_add_task()
- hosting_package_update_4 in package/
hosting_package.install - Package languages are associated to package instances, not packages
- hosting_package_update_5 in package/
hosting_package.install - Denormalize package and package release node types
- hosting_package_update_6 in package/
hosting_package.install - hosting_platform_insert in platform/
hosting_platform.module - Implementation of hook_insert().
- hosting_platform_update_1 in platform/
hosting_platform.install - Re-synch all platform to correctly set up the master url, so redirects on disabled sites will work correctly.
File
- task/
hosting_task.module, line 86 - Web server node type is defined here.
Code
function hosting_add_task($nid, $type, $args = null) {
global $user;
$node = node_load($nid);
$task = new stdClass();
$task->type = 'task';
$task->uid = $user->uid;
$task->status = 1;
#todo: make this pretty
$task->title = t("!type !title", array(
'!type' => $type,
'!title' => $node->title,
));
$task->task_type = $type;
$task->task_status = HOSTING_TASK_QUEUED;
$task->rid = $node->nid;
$task->queued = 1;
#arguments, such as which backup to restore.
if (is_array($args)) {
$task->task_args = $args;
}
node_save($task);
}