function background_batch_batch_alter in Background Process 7.2
Same name and namespace in other branches
- 8 background_batch/background_batch.module \background_batch_batch_alter()
- 6 background_batch/background_batch.module \background_batch_batch_alter()
- 7 background_batch/background_batch.module \background_batch_batch_alter()
Implements hook_batch_alter(). Steal the operation and hook into context data.
File
- background_batch/
background_batch.module, line 77 - This module adds background processing to Drupals batch API
Code
function background_batch_batch_alter(&$batch) {
if (!variable_get('background_batch_enabled', BACKGROUND_BATCH_ENABLED)) {
return;
}
if ($batch['progressive'] && $batch['url'] == '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);
}
// In order to make this batch session independend we save the owner UID.
global $user;
$batch['uid'] = $user->uid;
}