You are here

function acquia_agent_subscription_is_active in Acquia Connector 6

Same name and namespace in other branches
  1. 6.2 acquia_agent/acquia_agent.module \acquia_agent_subscription_is_active()
  2. 7.3 acquia_agent/acquia_agent.module \acquia_agent_subscription_is_active()
  3. 7 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.

2 calls to acquia_agent_subscription_is_active()
acquia_agent_requirements in acquia_agent/acquia_agent.install
Implementation of hook_requirements()
acquia_agent_translated_menu_link_alter in acquia_agent/acquia_agent.module
Implementation of hook_translated_menu_link_alter().

File

acquia_agent/acquia_agent.module, line 452
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;
}