Index: includes/batch.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/batch.inc,v retrieving revision 1.39 diff -u -p -r1.39 batch.inc --- includes/batch.inc 21 Sep 2009 07:56:07 -0000 1.39 +++ includes/batch.inc 21 Sep 2009 20:20:02 -0000 @@ -1,7 +1,6 @@ 'finish', 'id' => $batch['id'])); + } } } Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.375 diff -u -p -r1.375 form.inc --- includes/form.inc 21 Sep 2009 06:44:13 -0000 1.375 +++ includes/form.inc 21 Sep 2009 20:14:39 -0000 @@ -2921,7 +2921,7 @@ function batch_set($batch_definition) { * Process the batch. * * Unless the batch has been marked with 'progressive' = FALSE, the function - * issues a drupal_goto and thus ends page execution. + * issues a drupal_goto() and thus ends page execution. * * This function is generally not needed in form submit handlers; * Form API takes care of batches that were set during form submission. @@ -2931,8 +2931,13 @@ function batch_set($batch_definition) { * @param $url * (optional - should only be used for separate scripts like update.php) * URL of the batch processing page. + * @param $redirect_callback + * (optional) A function to call to redirect to the progressive processing + * page. By default, drupal_goto() is used to redirect to a page which will do + * the progressive page. Specifying another function will allow the + * progressive processing to be processed differently. */ -function batch_process($redirect = NULL, $url = NULL) { +function batch_process($redirect = NULL, $url = NULL, $redirect_callback = NULL) { $batch =& batch_get(); drupal_theme_initialize(); @@ -2947,6 +2952,7 @@ function batch_process($redirect = NULL, 'source_page' => $_GET['q'], 'redirect' => $redirect, 'theme' => $GLOBALS['theme_key'], + 'redirect_callback' => $redirect_callback, ); $batch += $process_info; @@ -2984,7 +2990,12 @@ function batch_process($redirect = NULL, // Set the batch number in the session to guarantee that it will stay alive. $_SESSION['batches'][$batch['id']] = TRUE; - drupal_goto($batch['url'], 'op=start&id=' . $batch['id']); + if (empty($redirect_callback)) { + $redirect_callback = 'drupal_goto'; + } + if (function_exists($redirect_callback)) { + $redirect_callback($batch['url'], array('op' => 'start', 'id' => $batch['id'])); + } } else { // Non-progressive execution: bypass the whole progressbar workflow Index: includes/update.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/update.inc,v retrieving revision 1.10 diff -u -p -r1.10 update.inc --- includes/update.inc 21 Sep 2009 08:07:07 -0000 1.10 +++ includes/update.inc 21 Sep 2009 20:13:34 -0000 @@ -364,8 +364,11 @@ class DrupalUpdateException extends Exce * scripts like update.php). * @param $batch * Optional parameters to pass into the batch API. + * @param $redirect_callback + * (optional) A function to call to redirect to the progressive processing + * page. */ -function update_batch($start, $redirect = NULL, $url = NULL, $batch = array()) { +function update_batch($start, $redirect = NULL, $url = NULL, $batch = array(), $redirect_callback = NULL) { // During the update, bring the site offline so that schema changes do not // affect visiting users. $_SESSION['maintenance_mode'] = variable_get('maintenance_mode', FALSE); @@ -396,7 +399,7 @@ function update_batch($start, $redirect 'file' => 'includes/update.inc', ); batch_set($batch); - batch_process($redirect, $url); + batch_process($redirect, $url, $redirect_callback); } /**