function _batch_progress_page_nojs

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

Batch processing page without JavaScript support.

2 calls to _batch_progress_page_nojs()
_batch_page in drupal-6.x/includes/batch.inc
State-based dispatcher for the batch processing page.
_batch_start in drupal-6.x/includes/batch.inc
Initiate the batch processing

File

drupal-6.x/includes/batch.inc, line 113
Batch processing API for processes to run in multiple HTTP requests.

Code

function _batch_progress_page_nojs() {
  $batch = &batch_get();
  $current_set = _batch_current_set();

  drupal_set_title($current_set['title']);

  $new_op = 'do_nojs';

  if (!isset($batch['running'])) {
    // This is the first page so we return some output immediately.
    $percentage = 0;
    $message = $current_set['init_message'];
    $batch['running'] = TRUE;
  }
  else {
    // This is one of the later requests: do some processing first.

    // Error handling: if PHP dies due to a fatal error (e.g. non-existant
    // function), it will output whatever is in the output buffer,
    // followed by the error message.
    ob_start();
    $fallback = $current_set['error_message'] . '<br/>' . $batch['error_message'];
    drupal_maintenance_theme();
    $fallback = theme('maintenance_page', $fallback, FALSE, FALSE);

    // We strip the end of the page using a marker in the template, so any
    // additional HTML output by PHP shows up inside the page rather than
    // below it. While this causes invalid HTML, the same would be true if
    // we didn't, as content is not allowed to appear after </html> anyway.
    list($fallback) = explode('<!--partial-->', $fallback);
    print $fallback;

    // Perform actual processing.
    list($percentage, $message) = _batch_process($batch);
    if ($percentage == 100) {
      $new_op = 'finished';
    }

    // PHP did not die : remove the fallback output.
    ob_end_clean();
  }

  $url = url($batch['url'], array('query' => array('id' => $batch['id'], 'op' => $new_op)));
  drupal_set_html_head('<meta http-equiv="Refresh" content="0; URL=' . $url . '">');
  $output = theme('progress_bar', $percentage, $message);
  return $output;
}