You are here

function node_deploy_operations_create_plan in Deploy - Content Staging 6

Helper function that creates a deployment plan.

1 call to node_deploy_operations_create_plan()
node_deploy_operations_add_now_form_submit in modules/node_deploy/node_deploy.pages.inc
Submit handler for node_deploy_operations_add_now_form().

File

modules/node_deploy/node_deploy.pages.inc, line 177
Page handlers for node deployment pages.

Code

function node_deploy_operations_create_plan($nids) {

  // If there is already a plan for this, then empty it and use it.
  // Otherwise create one.
  $pid = deploy_plan_exists('Nodes Now');
  if (!$pid) {
    $pid = deploy_create_plan('Nodes Now', 'Internal plan to deploy nodes', 1);
  }
  else {
    deploy_empty_plan($pid);
  }
  $result = db_query("SELECT nid, title, type FROM {node} WHERE nid IN (%s)", $nids);
  while ($row = db_fetch_array($result)) {
    if (!deploy_item_is_in_plan($pid, 'node', $row['nid'])) {
      deploy_add_to_plan($pid, 'node', $row['type'] . ': ' . $row['title'], $row['nid'], 0, DEPLOY_NODE_GROUP_WEIGHT);
    }
  }
  return $pid;
}