You are here

function acquia_search_acquia_subscription_status in Acquia Search 6.3

Same name and namespace in other branches
  1. 2.x acquia_search.module \acquia_search_acquia_subscription_status()

Implementation of hook_acquia_subscription_status().

File

./acquia_search.module, line 251
Integration between Acquia Drupal and Acquia's hosted solr search service.

Code

function acquia_search_acquia_subscription_status($active, $subscription = FALSE) {
  if ($active) {
    acquia_search_enable_acquia_solr_environment();

    // Refresh the salt with the subscription data returned by the heartbeat
    // since it can change periodically.
    $salt = variable_get('acquia_search_derived_key_salt', '');
    if (isset($subscription['derived_key_salt']) && $salt != $subscription['derived_key_salt']) {
      variable_set('acquia_search_derived_key_salt', $subscription['derived_key_salt']);
    }
  }
  else {
    if (is_int($subscription)) {
      switch ($subscription) {
        case SUBSCRIPTION_NOT_FOUND:
        case SUBSCRIPTION_EXPIRED:
          acquia_search_disable();
          break;
      }
    }
  }

  // Due to the fact the D6 does not have an update phase in hook_requirements,
  // we are moving this to a cron-based job.
  // @see http://drupal.org/node/1784770
  // @see acquia_search_requirements().
  _acquia_search_set_version();
}