You are here

function background_batch_batch_alter in Background Process 6

Same name and namespace in other branches
  1. 8 background_batch/background_batch.module \background_batch_batch_alter()
  2. 7.2 background_batch/background_batch.module \background_batch_batch_alter()
  3. 7 background_batch/background_batch.module \background_batch_batch_alter()

Fake batch alter hook for Drupal 6

1 call to background_batch_batch_alter()
_background_batch_page in background_batch/background_batch.pages.inc
State-based dispatcher for the batch processing page.

File

background_batch/background_batch.module, line 71
This module adds background processing to Drupals batch API

Code

function background_batch_batch_alter(&$batch) {
  foreach ($batch['sets'] as &$set) {
    if (!empty($set['operations'])) {
      foreach ($set['operations'] as &$operation) {
        $operation = array(
          '_background_batch_operation',
          array(
            $operation,
          ),
        );
      }
    }
  }
  $batch['timestamp'] = microtime(TRUE);
  $batch['batch_altered'] = TRUE;

  // In order to make this batch session independend we save the owner UID.
  global $user;
  $batch['uid'] = $user->uid;
}