You are here

function acquia_agent_subscription_is_active in Acquia Connector 7

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

Helper function to check if the site has an active subscription.

6 calls to acquia_agent_subscription_is_active()
acquia_agent_check_subscription in acquia_agent/acquia_agent.module
Get subscription status from the Acquia Network, and store the result.
acquia_agent_requirements in acquia_agent/acquia_agent.install
Implementation of hook_requirements()
acquia_agent_toolbar_add_links in acquia_agent/acquia_agent.module
Pre-render function which dynamically adds links to the toolbar.
acquia_search_enable in acquia_search/acquia_search.module
Implementation of hook_enable().
acquia_search_form_apachesolr_settings_alter in acquia_search/acquia_search.module
Implementation of hook_form_[form_id]_alter().

... See full list

File

acquia_agent/acquia_agent.module, line 448
Acquia Agent securely sends information to Acquia Network.

Code

function acquia_agent_subscription_is_active() {
  $active = FALSE;

  // Subscription cannot be active if we have no credentials.
  if (acquia_agent_has_credentials()) {
    $subscription = acquia_agent_settings('acquia_subscription_data');

    // Make sure we have data at least once per day.
    if (isset($subscription['timestamp']) && time() - $subscription['timestamp'] > 60 * 60 * 24) {
      $subscription = acquia_agent_check_subscription(array(
        'no_heartbeat' => 1,
      ));
    }
    $active = !empty($subscription['active']);
  }
  return $active;
}