function acquia_agent_init in Acquia Connector 7.3
Same name and namespace in other branches
- 6.2 acquia_agent/acquia_agent.module \acquia_agent_init()
- 6 acquia_agent/acquia_agent.module \acquia_agent_init()
- 7 acquia_agent/acquia_agent.module \acquia_agent_init()
- 7.2 acquia_agent/acquia_agent.module \acquia_agent_init()
Implements hook_init().
File
- acquia_agent/
acquia_agent.module, line 187 - 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);
}
}
$request = ltrim(request_uri(), DIRECTORY_SEPARATOR);
$hide_signup_messages = variable_get('acquia_agent_hide_signup_messages', 0);
if (!$hide_signup_messages && arg(0) != 'overlay-ajax' && arg(3) != 'acquia-agent' && empty($_POST) && user_access('administer site configuration') && !acquia_agent_has_credentials() && strpos($request, variable_get('file_public_path', conf_path() . DIRECTORY_SEPARATOR . 'files')) !== 0) {
$text = 'Sign up for Acquia Cloud Free, a free Drupal sandbox to experiment with new features, test your code quality, and apply continuous integration best practices. Check out the <a href="!acquia-free">epic set of dev features and tools</a> that come with your free subscription.<br/>If you have an Acquia Subscription, <a href="!settings">connect now</a>. Otherwise, you can turn this message off by disabling the Acquia Subscription modules.';
if (isset($_SERVER['AH_SITE_GROUP'])) {
$text = '<a href="!settings">Connect your site to Acquia now</a>. <a href="!more">Learn more</a>.';
}
// phpcs:ignore
$message = t($text, array(
'!acquia-free' => url('https://www.acquia.com/acquia-cloud-free'),
'!settings' => url('admin/config/system/acquia-agent/setup'),
));
drupal_set_message($message, 'warning', FALSE);
}
}