Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
File background_batch.pages.inc
Function _background_batch_page()
This code should be executed on Drupal 6, because there is not defined $batch['batch_altered'].
// Manually call our alter if hook_batch_alter() is unsupported on this system.
if (empty($batch['batch_altered'])) {
background_batch_batch_alter($batch);
// Save batch to DB.
_batch_shutdown();
}
BUT... if module Better Batch is enabled, it backports hook_batch_alter() and $batch['batch_altered'] is defined.
My solution
if (DRUPAL_CORE_COMPATIBILITY == '6.x') {
Comments
Comment #1
Xperd CreditAttribution: Xperd commentedComment #2
gielfeldt CreditAttribution: gielfeldt commentedI'm not sure I understand the problem. If Better Batch is installed the alter function is called and $batch['batch_altered'] is set. And then we don't want to call it a second time.
Comment #3
gielfeldt CreditAttribution: gielfeldt commented