You are here

function deploy_push_batch in Deploy - Content Staging 6

Batch API callback for the deployment push process.

1 string reference to 'deploy_push_batch'
deploy_menu in ./deploy.module
Implementation of hook_menu().

File

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

Code

function deploy_push_batch() {
  $operations = array();
  $pid = variable_get('deploy_pid', '');
  $items = deploy_get_plan_items($pid);

  // The batch oeprations are calls to deploy_item_batch(), which is just a wrapper
  // to deploy_item() plus batch pi messaging.
  foreach ($items as $item) {
    $operations[] = array(
      'deploy_item_batch',
      array(
        $item,
      ),
    );
  }

  // And call deploy_plan_cleanup() when done.
  $operations[] = array(
    'deploy_plan_cleanup',
    array(),
  );
  $batch = array(
    'operations' => $operations,
    'title' => t('Pushing deployment plan.'),
    'init_message' => t('Deployment is starting.'),
    'progress_message' => t('Pushing item @current out of @total.'),
    'error_message' => t('Deployment has encountered an error.'),
  );

  // When complete, redirect to the log for this deployment.
  $dlid = variable_get('deploy_log_id', '');
  batch_set($batch);
  batch_process("admin/build/deploy/logs/details/{$dlid}");
}