function _batch_page

7.x batch.inc _batch_page()
6.x batch.inc _batch_page()

State-based dispatcher for the batch processing page.

3 calls to _batch_page()
install_tasks in drupal-6.x/install.php
Tasks performed after the database is initialized.
system_batch_page in drupal-6.x/modules/system/system.admin.inc
Default page callback for batches.
update.php in drupal-6.x/update.php
Administrative page for handling updates from one Drupal version to another.

File

drupal-6.x/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;
}