You are here

function acquia_spi_process_messages in Acquia Connector 7.3

Parses and displays messages from the NSPI response.

Parameters

mixed $response: Response array from NSPI.

3 calls to acquia_spi_process_messages()
acquia_agent_spi_set_submit in acquia_spi/acquia_spi.module
Save the results of NSPI form and submit to server if machine name changed.
acquia_spi_environment_change_form_submit in acquia_spi/acquia_spi.pages.inc
Save environment change form submissions.
_acquia_spi_send in acquia_spi/acquia_spi.module
Callback for sending SPI data.

File

acquia_spi/acquia_spi.module, line 1855
Send site profile information (NSPI) and system data to Acquia Insight.

Code

function acquia_spi_process_messages($response) {
  if (empty($response)) {
    drupal_set_message(t('Error sending SPI data. Consult the logs for more information.'), 'error');
    return;
  }
  $message = array();
  $message_type = 'status';
  if (isset($response['spi_data_received']) && $response['spi_data_received'] === TRUE) {
    $message[] = t('SPI data sent.');
  }
  if (!empty($response['nspi_messages'])) {
    $message[] = t('Acquia Insight returned the following messages. Further information may be in the logs.');
    foreach ($response['nspi_messages'] as $nspi_message) {
      if (!empty($response['spi_error'])) {
        $message_type = $response['spi_error'];
      }
      $message[] = check_plain($nspi_message);
    }
  }
  if (!empty($response['spi_environment_changes'])) {
    variable_set('acquia_spi_environment_changes', drupal_json_decode($response['spi_environment_changes']));
  }
  drupal_set_message(implode('<br/>', $message), $message_type);
}