You are here

function hosting_task_set_title in Hostmaster (Aegir) 6

Set the title of tasks automatically and in a consistent way

Tasks should always be named 'task_type node_title'.

2 calls to hosting_task_set_title()
hosting_task_insert in modules/hosting/task/hosting_task.module
Implementation of hook_insert().
hosting_task_update in modules/hosting/task/hosting_task.module
Implementation of hook_update().

File

modules/hosting/task/hosting_task.module, line 504
Web server node type is defined here.

Code

function hosting_task_set_title(&$node) {
  $ref = db_fetch_object(db_query("SELECT vid, nid, title, type FROM {node} WHERE nid=%d", $node->rid));
  $tasks = hosting_available_tasks($ref->type);
  $node->title = drupal_ucfirst($tasks[$node->task_type]['title']) . ': ' . $ref->title;
  db_query("UPDATE {node} SET title='%s' WHERE nid=%d", $node->title, $node->nid);
  db_query("UPDATE {node_revisions} SET title='%s' WHERE vid=%d", $node->title, $node->vid);
}