diff --git a/core/includes/batch.inc b/core/includes/batch.inc index 83ddd3088bd..0b07d8e181b 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -14,6 +14,8 @@ * @see batch_get() */ +use \Symfony\Component\HttpFoundation\JsonResponse; + /** * Loads a batch from the database. * @@ -77,7 +79,7 @@ function _batch_page() { case 'do': // JavaScript-based progress page callback. - _batch_do(); + $output = _batch_do(); break; case 'do_nojs': @@ -160,7 +162,7 @@ function _batch_do() { // Perform actual processing. list($percentage, $message) = _batch_process(); - drupal_json_output(array('status' => TRUE, 'percentage' => $percentage, 'message' => $message)); + return new JsonResponse(array('status' => TRUE, 'percentage' => $percentage, 'message' => $message)); } /** diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 978b0f4131f..783cc16852d 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -5,6 +5,8 @@ * Admin page callbacks for the system module. */ +use Symfony\Component\HttpFoundation\Response; + /** * Menu callback; Provide the administration overview page. */ @@ -2358,6 +2360,9 @@ function system_batch_page() { if ($output === FALSE) { drupal_access_denied(); } + elseif ($output instanceof Response) { + return $output; + } elseif (isset($output)) { // Force a page without blocks or messages to // display a list of collected messages later.