You are here

function deploy_plan_init in Deploy - Content Staging 6

Initiate depolyment.

Parameters

$pid: ID of the plan to deploy.

$sid: ID of the server to deploy to.

$settings: Server settings that was posted from the server form.

5 calls to deploy_plan_init()
comment_deploy_operations_add_now_form_submit in modules/comment_deploy/comment_deploy.pages.inc
Submit handler for comment_deploy_operations_add_now_form().
deploy_plan_push_form_submit in ./deploy.module
Submit callback for deploy_plan_push_form()
drush_deploy in includes/deploy.drush.inc
Deploy a plan from the command line with drush.
node_deploy_operations_add_now_form_submit in modules/node_deploy/node_deploy.pages.inc
Submit handler for node_deploy_operations_add_now_form().
taxonomy_vocabulary_deploy_add_form_submit in modules/taxonomy_deploy/taxonomy_deploy.pages.inc
Submit handler for taxonomy_vocabulary_deploy_add_form().

File

./deploy.module, line 685
Deployment API which enables modules to deploy items between servers.

Code

function deploy_plan_init($pid, $sid, $settings = array()) {
  include_once './includes/xmlrpc.inc';
  global $user;
  $plan = deploy_get_plan($pid);
  $server = deploy_get_server($sid);

  // Abort if we didn't find a plan or server.
  if (empty($plan) || empty($server)) {
    return FALSE;
  }

  // Also add settings that came from the submitted server form.
  $server['settings'] = $settings;

  // Save this data out so the other modules can get it. Not sure of a better
  // way to handle this.
  variable_set('deploy_server', $server);
  variable_set('deploy_pid', $pid);

  // This used to be a static within deploy_item(), but batch API breaks
  // statics so I was forced down this route instead.
  variable_set('deploy_fatal', FALSE);

  // Rather than save foreign keys out to the server/plan/user in the log,
  // I'm saving actual identifying data. This keeps the log pure in case
  // associated data gets deleted.
  db_query("INSERT INTO {deploy_log} (plan, server, username, ts) VALUES ('%s', '%s', '%s', %d)", $plan['name'], $server['description'], $user->name, time());
  variable_set('deploy_log_id', db_last_insert_id('deploy_log', 'dlid'));

  // Allow other modules to do stuff before the content gets pushed.
  module_invoke_all('deploy_pre_plan', $pid);
  return deploy_auth_invoke($server['auth_type'], 'init callback', $server);
}