Comments

kim.pepper’s picture

Status: Active » Needs review
StatusFileSize
new22.98 KB

Initial patch.

Status: Needs review » Needs work

The last submitted patch, 1: 2320469-batch-service-1.patch, failed testing.

kim.pepper’s picture

StatusFileSize
new29.43 KB
new14.65 KB

Moved some more batch code out of form.inc and injected services.

kim.pepper’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: 2320469-batch-service-3.patch, failed testing.

dawehner’s picture

  1. +++ b/core/includes/batch.inc
    @@ -210,133 +210,11 @@ function _batch_progress_page() {
     function _batch_process() {
    
    @@ -357,6 +235,8 @@ function _batch_process() {
      * @see _batch_process()
    ...
     function _batch_api_percentage($total, $current) {
    
    @@ -364,10 +244,11 @@ function _batch_api_percentage($total, $current) {
     function &_batch_current_set() {
    
    @@ -379,20 +260,11 @@ function &_batch_current_set() {
     function _batch_next_set() {
    
    @@ -402,90 +274,7 @@ function _batch_next_set() {
     function _batch_finished() {
    
    +++ b/core/includes/form.inc
    @@ -3035,26 +3035,12 @@ function &batch_get() {
     function _batch_populate_queue(&$batch, $set_id) {
    
    @@ -3065,23 +3051,11 @@ function _batch_populate_queue(&$batch, $set_id) {
     function _batch_queue($batch_set) {
    

    These are internal functions already, can't you get rid of them directly?

  2. +++ b/core/lib/Drupal/Core/Batch/BatchProcessor.php
    @@ -0,0 +1,324 @@
    +
    +require_once DRUPAL_ROOT . '/core/includes/form.inc';
    +
    

    :(

  3. +++ b/core/lib/Drupal/Core/Batch/BatchProcessor.php
    @@ -0,0 +1,324 @@
    +        include_once DRUPAL_ROOT . '/' . $current_set['file'];
    

    If we do have a service you can use %app.root%

  4. +++ b/core/lib/Drupal/Core/Batch/BatchProcessor.php
    @@ -0,0 +1,324 @@
    +        $redirect = $_batch['batch_redirect'] ?: $_batch['source_url'];
    +        $options = UrlHelper::parse($redirect);
    +        if (!UrlHelper::isExternal($options['path'])) {
    +          $options['path'] = $GLOBALS['base_url'] . '/' . $options['path'];
    +        }
    +        $redirect = Url::createFromPath($options['path']);
    +        $redirect->setOptions($options);
    +        $_batch['form_state']->setRedirectUrl($redirect);
    

    Follow up: Would be great if this batch_redirect would also just support an URL object, so route name + parameter.

  5. +++ b/core/lib/Drupal/Core/Batch/BatchProcessorInterface.php
    @@ -0,0 +1,56 @@
    +interface BatchProcessorInterface {
    

    Cool, this interface actually looks nice!

  6. +++ b/core/lib/Drupal/Core/Batch/BatchQueueHandlerInterface.php
    @@ -0,0 +1,43 @@
    +   * Depending on whether the batch is progressive or not, the
    +   * Drupal\Core\Queue\Batch or Drupal\Core\Queue\BatchMemory handler classes
    +   * will be used.
    +   *
    +   * @param array $batch
    +   *   The batch array.
    

    Here could be a good place to actually document the entries of a batch thing. At some time then we can convert this to a new value object, which then would allow actual documentation. yeah!

kim.pepper’s picture

StatusFileSize
new35.29 KB
new9.73 KB

Thanks for the review @dawehner.

I've removed the depecated functions, and updated the documentation.

I'm not really across the complexities of the batch system, so this is proving... challenging.

Hoping someone who knows more can jump in and help out.

tim.plunkett’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: 2320469-batch-service-7.patch, failed testing.

neclimdul’s picture

Assigned: Unassigned » neclimdul

Conflict: http://cgit.drupalcode.org/drupal/commit/core/includes/batch.inc?id=dbed...

Resolved but currently this patch breaks the careful balance of the batch global hacks. Looking into it.

rickvug’s picture

Issue tags: +Needs re-roll
rickvug’s picture

Issue tags: -Needs re-roll +Needs reroll
larowlan’s picture

Is this now 8.1 or 9.0 territory (sadly)? Or can we keep the functional stuff as BC?

nitesh sethia’s picture

Issue tags: -Needs reroll +#drupalgoa2015
StatusFileSize
new35.29 KB

Rerolled

nitesh sethia’s picture

StatusFileSize
new24.41 KB
nitesh sethia’s picture

Assigned: neclimdul » Unassigned
Status: Needs work » Needs review

The last submitted patch, 14: move_batch_processing-2320469-14.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 15: move_batch_processing-2320469-15.patch, failed testing.

larowlan’s picture

Issue tags: +Needs reroll
pguillard’s picture

StatusFileSize
new24.36 KB

Rerolled

pguillard’s picture

Issue tags: -Needs reroll
jeroent’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 20: move_batch_processing-2320469-20.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 20: move_batch_processing-2320469-20.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new25.92 KB
new8.11 KB

Will work on that for a while. This could fix some stuff already.

dawehner’s picture

StatusFileSize
new38.4 KB
new12.61 KB
  • Remove old code, BC layer is no needed as all methods have been internal and replaced by the new service.

Status: Needs review » Needs work

The last submitted patch, 27: 2320469-27.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new39.95 KB
new2.04 KB

Meh tests ...

dawehner’s picture

StatusFileSize
new50.06 KB
new15.76 KB

Move batch_process() to the service itself.

Status: Needs review » Needs work

The last submitted patch, 30: 2320469-30.patch, failed testing.

The last submitted patch, 29: 2320469-29.patch, failed testing.

dawehner’s picture

StatusFileSize
new44.69 KB
new14.96 KB

Move batch_process() to the service itself.

This is not really needed in this issue, let's skip it.

kim.pepper’s picture

Status: Needs work » Needs review

Let's invoke the bots.

Status: Needs review » Needs work

The last submitted patch, 33: 2320469-31.patch, failed testing.

The last submitted patch, 26: 2320469-26.patch, failed testing.

The last submitted patch, 26: 2320469-26.patch, failed testing.

The last submitted patch, 26: 2320469-26.patch, failed testing.

pguillard’s picture

Status: Needs work » Needs review
StatusFileSize
new44.69 KB
new501 bytes

Something strange was introduced in #31. I just commented it.

Status: Needs review » Needs work

The last submitted patch, 39: move_batch_processing_to_service-2320469-39.patch, failed testing.

mile23’s picture

Version: 8.0.x-dev » 8.1.x-dev

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

john cook’s picture

There is a two step process underway in other tickets.

First, change the batch api to be OO rather than procedural - https://www.drupal.org/node/2401797

Then change the batch processing to a service - https://www.drupal.org/node/2875151

The code in Introduce a batch object to make the batch API easier to use is currently applying cleanly to 8.5.x, so I'd like to continue with that. (But then I'm biased.)

I'd like to know what @kim.pepper, @pguillard, and @Nitesh Sethia think, as they've done a lot of the work on this patch.

john cook’s picture

Status: Needs work » Closed (duplicate)

I'm marking this issue as "Duplicate" in favor of #2401797: Introduce a batch builder class to make the batch API easier to use and #2875151: [META] Implement Batch API as a service.

I've placed a comment on #2875151 requesting that the contributors here are credited on that issue instead. If you contributed to this issue, please go to #2875151: [META] Implement Batch API as a service and comment to help the committer give you credit.