function acquia_agent_check_subscription in Acquia Connector 6
Same name and namespace in other branches
- 6.2 acquia_agent/acquia_agent.module \acquia_agent_check_subscription()
- 7.3 acquia_agent/acquia_agent.module \acquia_agent_check_subscription()
- 7 acquia_agent/acquia_agent.module \acquia_agent_check_subscription()
- 7.2 acquia_agent/acquia_agent.module \acquia_agent_check_subscription()
Get subscription status from the Acquia Network, and store the result.
This check also sends a heartbeat to the Acquia Network unless $params['no_heartbeat'] == 1.
7 calls to acquia_agent_check_subscription()
- acquia_agent_cron in acquia_agent/
acquia_agent.module - Implementation of hook_cron().
- acquia_agent_manual_status in acquia_agent/
acquia_agent.module - Substituted menu callback for 'admin/reports/updates/check'.
- acquia_agent_refresh_status in acquia_agent/
acquia_agent.module - Menu callback for 'admin/settings/acquia-agent/refresh-status'.
- acquia_agent_set_submit in acquia_agent/
acquia_agent.pages.inc - Save acquia_agent_settings form submissions.
- acquia_agent_subscription_is_active in acquia_agent/
acquia_agent.module - Helper function to check if the site has an active subscription.
File
- acquia_agent/
acquia_agent.module, line 78 - Acquia Agent securely sends information to Acquia Network.
Code
function acquia_agent_check_subscription($params = array()) {
// Default return value is FALSE.
$subscription = FALSE;
if (!acquia_agent_has_credentials()) {
// If there is not an identifier or key, delete any old subscription data.
variable_del('acquia_subscription_data');
}
else {
// There is an identifier and key, so attempt communication.
// Include version number information.
acquia_agent_load_versions();
if (IS_ACQUIA_DRUPAL) {
$params['version'] = ACQUIA_DRUPAL_VERSION;
$params['series'] = ACQUIA_DRUPAL_SERIES;
$params['branch'] = ACQUIA_DRUPAL_BRANCH;
$params['revision'] = ACQUIA_DRUPAL_REVISION;
}
// Include Acquia Search module version number.
if (module_exists('acquia_search')) {
$result = db_query("SELECT name, info FROM {system} WHERE name IN ('acquia_search', 'apachesolr')");
while ($data = db_fetch_object($result)) {
if ($info = unserialize($data->info)) {
// Send the version, or at least the core compatibility as a fallback.
$params['search_version'][$data->name] = isset($info['version']) ? (string) $info['version'] : (string) $info['core'];
}
}
}
$data = acquia_agent_call('acquia.agent.subscription', $params);
$subscription['timestamp'] = time();
if ($errno = xmlrpc_errno()) {
switch ($errno) {
case SUBSCRIPTION_NOT_FOUND:
case SUBSCRIPTION_EXPIRED:
variable_del('acquia_subscription_data');
break;
}
}
elseif (acquia_agent_valid_response($data)) {
$subscription += $data['result']['body'];
variable_set('acquia_subscription_data', $subscription);
// use: acquia_agent_settings('acquia_subscription_data');
}
else {
watchdog('acquia agent', 'HMAC validation error: <pre>@data</pre>', array(
'@data' => print_r($data, TRUE),
), WATCHDOG_ERROR);
}
}
return $subscription;
}