You are here

function _batch_page in Drupal 6

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

State-based dispatcher for the batch processing page.

3 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.
update.php in ./update.php
Administrative page for handling updates from one Drupal version to another.

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;
}