You are here

function deploy_check_batch in Deploy - Content Staging 6

Batch API callback for the hook_deploy_check() process.

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

File

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

Code

function deploy_check_batch() {
  $operations = array();
  $pid = variable_get('deploy_pid', '');
  $items = deploy_get_plan_items($pid);
  watchdog('plan items', print_r($items, TRUE));

  // The batch operations are calls to deploy_plan_check_item_batch(), which is
  // just a wrapper for deploy_plan_check_item() plus the batch api messaging.
  foreach ($items as $item) {
    $operations[] = array(
      'deploy_plan_check_item_batch',
      array(
        $item['module'],
        $item['data'],
        $item['description'],
      ),
    );
  }

  // Also call the deploy_check_cleanup() hook at the end.
  $operations[] = array(
    'module_invoke_all',
    array(
      'deploy_check_cleanup',
      $pid,
    ),
  );

  // And fire our batch. This batch may add items to the deployment plan,
  // thus increasing our operations for the actual push. So once the
  // checking is done, redirect to a second batch process for the actual
  // pushing.
  $batch = array(
    'operations' => $operations,
    'title' => t('Processing deployment plan dependencies.'),
    'init_message' => t('Deployment dependency checking is starting.'),
    'progress_message' => t('Checking item @current out of @total.'),
    'error_message' => t('Deployment dependency checking has encountered an error.'),
  );
  batch_set($batch);
  batch_process("admin/build/deploy/deploy_push_batch");
}