You are here

function _acquia_purge_diagnostics_acquia_auth_token in Acquia Purge 7

Acquia auth token.

Parameters

string $t: Name of the t() function to call.

AcquiaPurgeService $service: The Acquia Purge service.

Return value

array Associative array with the following elements:

1 string reference to '_acquia_purge_diagnostics_acquia_auth_token'
acquia_purge_acquia_purge_diagnostics in ./acquia_purge.module
Implements hook_acquia_purge_diagnostics().

File

./acquia_purge.diagnostics.inc, line 215
Diagnostic self-tests and reports that aim to prevent runtime misery.

Code

function _acquia_purge_diagnostics_acquia_auth_token($t, $service) {
  $test = array(
    'title' => $t('Acquia auth token'),
    'value' => $service
      ->hostingInfo()
      ->getBalancerToken(),
    'severity' => ACQUIA_PURGE_SEVLEVEL_INFO,
  );
  if ($service
    ->oddities()
    ->has('405')) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_WARNING;
    $test['description'] = $t('Acquia Purge received HTTP 405 (not allowed) responses from one of' . ' your load balancers! What this suggests is that your authentication' . ' token is (or has been) invalid. If cache invalidation constantly' . ' appears to fail, please contact Acquia support.');
  }
  elseif (!strlen($service
    ->hostingInfo()
    ->getBalancerToken())) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_ERROR;
    $test['description'] = $t('Empty token configured!');
  }
  return $test;
}