function _drush_backend_integrate

8.0.x backend.inc _drush_backend_integrate($data, $backend_options, $outputted)
6.x backend.inc _drush_backend_integrate($data, $backend_options, $outputted)
7.x backend.inc _drush_backend_integrate($data, $backend_options, $outputted)
3.x backend.inc _drush_backend_integrate($data)
4.x backend.inc _drush_backend_integrate($data)
5.x backend.inc _drush_backend_integrate($data, $backend_options, $outputted)
master backend.inc _drush_backend_integrate($data, $backend_options, $outputted)

Integrate log messages and error statuses into the current process.

Output produced by the called script will be printed, errors will be set and log messages will be logged locally.

Parameters

data: The associative array returned from the external command.

1 call to _drush_backend_integrate()
drush_backend_parse_output in includes/backend.inc
Parse output returned from a Drush command.

File

includes/backend.inc, line 191
Drush backend API

Code

function _drush_backend_integrate($data) {
  if (is_array($data['log'])) {
    foreach ($data['log'] as $log) {
      $message = is_array($log['message']) ? implode("\n", $log['message']) : $log['message'];
      if (!is_null($log['error'])) {
        drush_set_error($log['error'], $message);
      }
      else {
        drush_log($message, $log['type']);
      }
    }
  }
  // Output will either be printed, or buffered to the drush_backend_output command.
  if (drush_cmp_error('DRUSH_APPLICATION_ERROR') && !empty($data['output'])) {
    drush_set_error("DRUSH_APPLICATION_ERROR", dt("Output from failed command :\n !output", array('!output' => $data['output'])));
  }
  else {
    print ($data['output']);
  }

}