Same name and namespace in other branches
  1. 10 core/includes/batch.inc \_batch_do()
  2. 7.x includes/batch.inc \_batch_do()
  3. 8.9.x core/includes/batch.inc \_batch_do()
  4. 9 core/includes/batch.inc \_batch_do()

Do one pass of execution and inform back the browser about progression (used for JavaScript-mode only).

File

includes/batch.inc, line 96
Batch processing API for processes to run in multiple HTTP requests.

Code

function _batch_do() {

  // HTTP POST required
  if ($_SERVER['REQUEST_METHOD'] != 'POST') {
    drupal_set_message(t('HTTP POST is required.'), 'error');
    drupal_set_title(t('Error'));
    return '';
  }

  // Perform actual processing.
  list($percentage, $message) = _batch_process();
  drupal_json(array(
    'status' => TRUE,
    'percentage' => $percentage,
    'message' => $message,
  ));
}