diff --git a/core/includes/batch.inc b/core/includes/batch.inc index d12b603..94524e2 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -26,6 +26,8 @@ * The current request object. * * @see _batch_shutdown() + * + * @internal */ function _batch_page(Request $request) { $batch = &batch_get(); @@ -111,6 +113,8 @@ function _batch_page(Request $request) { * * @return bool * TRUE if the batch information needs to be updated; FALSE otherwise. + * + * @internal */ function _batch_needs_update($new_value = NULL) { $needs_update = &drupal_static(__FUNCTION__, FALSE); @@ -127,18 +131,27 @@ function _batch_needs_update($new_value = NULL) { * * @see _batch_progress_page_js() * @see _batch_process() + * + * @internal */ function _batch_do() { // Perform actual processing. list($percentage, $message, $label) = _batch_process(); - return new JsonResponse(['status' => TRUE, 'percentage' => $percentage, 'message' => $message, 'label' => $label]); + return new JsonResponse([ + 'status' => TRUE, + 'percentage' => $percentage, + 'message' => $message, + 'label' => $label, + ]); } /** * Outputs a batch processing page. * * @see _batch_process() + * + * @internal */ function _batch_progress_page() { $batch = &batch_get(); @@ -217,7 +230,8 @@ function _batch_progress_page() { 'batch_progress_meta_refresh', ], ], - // Adds JavaScript code and settings for clients where JavaScript is enabled. + // Adds JavaScript code and settings for clients where JavaScript is + // enabled. 'drupalSettings' => [ 'batch' => [ 'errorMessage' => $current_set['error_message'] . '
' . $batch['error_message'], @@ -243,6 +257,8 @@ function _batch_progress_page() { * * @return array * An array containing a completion value (in percent) and a status message. + * + * @internal */ function _batch_process() { return BatchQueueController::processQueue(); @@ -250,6 +266,8 @@ function _batch_process() { /** * Returns the batch set being currently processed. + * + * @internal */ function &_batch_current_set() { return BatchQueueController::getCurrentSet(); @@ -265,6 +283,8 @@ function &_batch_current_set() { * @return true|null * TRUE if a subsequent set was found in the batch; no value will be returned * if no subsequent set was found. + * + * @internal */ function _batch_next_set() { return BatchQueueController::nextSet(); @@ -275,6 +295,8 @@ function _batch_next_set() { * * Call the 'finished' callback of each batch set to allow custom handling of * the results and resolve page redirection. + * + * @internal */ function _batch_finished() { return BatchQueueController::finishedProcessing(); @@ -285,6 +307,8 @@ function _batch_finished() { * * @see _batch_page() * @see drupal_register_shutdown_function() + * + * @internal */ function _batch_shutdown() { if (($batch = batch_get()) && _batch_needs_update()) { diff --git a/core/includes/form.inc b/core/includes/form.inc index b4a8e10..585dbae 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -713,9 +713,6 @@ function template_preprocess_form_element_label(&$variables) { * Typically, the class will either be \Drupal\Core\Queue\Batch or * \Drupal\Core\Queue\BatchMemory. Defaults to Batch if progressive is * TRUE, or to BatchMemory if progressive is FALSE. - * - * @deprecated as of Drupal 8.2.x, will be removed in Drupal 9.0.0. Create a - * \Drupal\Core\Batch\Batch object and use the enqueue() function. */ function batch_set($batch_definition) { if (!($batch_definition instanceof Batch)) { @@ -746,16 +743,12 @@ function batch_set($batch_definition) { * @param \Drupal\Core\Url $url * (optional) URL of the batch processing page. Should only be used for * separate scripts like update.php. - * @param $redirect_callback + * @param string|null $redirect_callback * (optional) Specify a function to be called to redirect to the progressive * processing page. * * @return \Symfony\Component\HttpFoundation\RedirectResponse|null * A redirect response if the batch is progressive. No return value otherwise. - * - * @deprecated as of Drupal 8.2.x, will be removed in Drupal 9.0.0. Use - * \Drupal\Core\Batch\Batch::process() instead or the process() function on - * an existing Batch object. */ function batch_process($redirect = NULL, Url $url = NULL, $redirect_callback = NULL) { return BatchQueueController::process($redirect, $url, $redirect_callback); diff --git a/core/lib/Drupal/Core/Batch/Batch.php b/core/lib/Drupal/Core/Batch/Batch.php index 5475d06..291b785 100644 --- a/core/lib/Drupal/Core/Batch/Batch.php +++ b/core/lib/Drupal/Core/Batch/Batch.php @@ -137,7 +137,7 @@ public static function create() { * A new object. */ public static function createFromTitle($title) { - return self::create()->setTitle($title); + return static::create()->setTitle($title); } /** @@ -150,7 +150,7 @@ public static function createFromTitle($title) { * A new initialized object. */ public static function createFromArray(array $batch_definition) { - $new_batch = self::create(); + $new_batch = static::create(); if (isset($batch_definition['operations'])) { foreach ($batch_definition['operations'] as list($callback, $arguments)) { @@ -199,16 +199,14 @@ public static function createFromArray(array $batch_definition) { $new_batch->setProgressive($batch_definition['progressive']); } - if (isset($batch_definition['queue'])) { - if ( - isset($batch_definition['queue']['name']) && - isset($batch_definition['queue']['class']) - ) { - $new_batch->setQueue( - $batch_definition['queue']['name'], - $batch_definition['queue']['class'] - ); - } + if ( + isset($batch_definition['queue']['name']) && + isset($batch_definition['queue']['class']) + ) { + $new_batch->setQueue( + $batch_definition['queue']['name'], + $batch_definition['queue']['class'] + ); } return $new_batch; diff --git a/core/lib/Drupal/Core/Batch/BatchQueueController.php b/core/lib/Drupal/Core/Batch/BatchQueueController.php index 408dd90..c96c713 100644 --- a/core/lib/Drupal/Core/Batch/BatchQueueController.php +++ b/core/lib/Drupal/Core/Batch/BatchQueueController.php @@ -14,6 +14,8 @@ /** * Handles operations on the batch processes to be handled. + * + * @internal */ class BatchQueueController {