diff --git a/commands/core/drupal/batch.inc b/commands/core/drupal/batch.inc index 2823dd6..a443ce9 100644 --- a/commands/core/drupal/batch.inc +++ b/commands/core/drupal/batch.inc @@ -4,6 +4,15 @@ * Drupal 7 engine for the Batch API */ + +class BatchArrayObject extends ArrayObject { + public function offsetSet($name, $value) { + if ($name == 'message') { + drush_log($value, 'ok'); + } + } +} + /** * Main loop for the Drush batch API. * @@ -134,12 +143,11 @@ function _drush_batch_worker() { list($function, $args) = $item->data; // Build the 'context' array and execute the function call. - $batch_context = array( - 'sandbox' => &$current_set['sandbox'], - 'results' => &$current_set['results'], - 'finished' => &$finished, - 'message' => &$task_message, - ); + $batch_context = new BatchArrayObject(); + $batch_context['sandbox'] = $current_set['sandbox']; + $batch_context['results'] = $current_set['results']; + $batch_context['finished'] = $finished; + $batch_context['message'] = $task_message; call_user_func_array($function, array_merge($args, array(&$batch_context))); if ($finished == 1) {