You are here

function acquia_agent_init in Acquia Connector 7.2

Same name and namespace in other branches
  1. 6.2 acquia_agent/acquia_agent.module \acquia_agent_init()
  2. 6 acquia_agent/acquia_agent.module \acquia_agent_init()
  3. 7.3 acquia_agent/acquia_agent.module \acquia_agent_init()
  4. 7 acquia_agent/acquia_agent.module \acquia_agent_init()

Implements hook_init().

File

acquia_agent/acquia_agent.module, line 200
Acquia Agent securely sends information to Acquia Insight.

Code

function acquia_agent_init() {

  // Auto-connect with Acquia Cloud credentials if there's not currently a
  // connection or credentials set.
  if (!acquia_agent_has_credentials() && !variable_get('acquia_subscription_data', FALSE) && variable_get('ah_network_key', FALSE) && variable_get('ah_network_identifier', FALSE)) {
    variable_set('acquia_identifier', variable_get('ah_network_identifier', FALSE));
    variable_set('acquia_key', variable_get('ah_network_key', FALSE));
    $activated = acquia_agent_check_subscription();
    if ($activated && user_access('administer site configuration')) {
      $text = t('Your site has been automatically connected to Acquia. <a href="!url">Change subscription</a>', array(
        '!url' => url('admin/config/system/acquia-agent/setup'),
      ));
      drupal_set_message($text, 'status', FALSE);
    }
  }
}