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

State-based dispatcher for the batch processing page.

2 calls to _batch_page()
install_tasks in ./install.php
Tasks performed after the database is initialized.
system_batch_page in modules/system/system.admin.inc
Default page callback for batches.

File

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

Code

function _batch_page() {
  $batch =& batch_get();

  // Retrieve the current state of batch from db.
  if (isset($_REQUEST['id']) && ($data = db_result(db_query("SELECT batch FROM {batch} WHERE bid = %d AND token = '%s'", $_REQUEST['id'], drupal_get_token($_REQUEST['id']))))) {
    $batch = unserialize($data);
  }
  else {
    return FALSE;
  }

  // Register database update for end of processing.
  register_shutdown_function('_batch_shutdown');
  $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
  $output = NULL;
  switch ($op) {
    case 'start':
      $output = _batch_start();
      break;
    case 'do':

      // JS-version AJAX callback.
      _batch_do();
      break;
    case 'do_nojs':

      // Non-JS progress page.
      $output = _batch_progress_page_nojs();
      break;
    case 'finished':
      $output = _batch_finished();
      break;
  }
  return $output;
}