You are here

function _acquia_purge_diagnostics_page_cache in Acquia Purge 7

Page cache.

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_page_cache'
acquia_purge_acquia_purge_diagnostics in ./acquia_purge.module
Implements hook_acquia_purge_diagnostics().

File

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

Code

function _acquia_purge_diagnostics_page_cache($t, $service) {
  $cache = variable_get('cache', 0);
  $cache_backend = $service
    ->hostingInfo()
    ->getPageCacheBackend();
  $test = array(
    'severity' => ACQUIA_PURGE_SEVLEVEL_OK,
    'value' => $cache ? $t('Enabled (@b)', array(
      '@b' => $cache_backend,
    )) : $t('Disabled'),
    'title' => $t('Page cache'),
  );

  // See https://www.drupal.org/node/2330805
  if (!$cache && module_exists('authcache')) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_OK;
    $test['value'] = $t('Disabled (because of Authcache)');
  }
  elseif (!$cache) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_ERROR;
    $test['description'] = $t('Your site has Drupal page caching disabled,' . ' which is of extreme importance to every website that gets traffic.' . ' Once enabled your load balancer will be instructed to start serving' . ' pages from its cache to offload traffic from your web servers. The' . ' more traffic served from your load balancer, the faster your' . ' site will be!');
  }
  elseif ($service
    ->hostingInfo()
    ->isPageCacheFake()) {
    $test['value'] = $t("Enabled (DrupalFakeCache, executor disabled)");
  }
  elseif ($service
    ->oddities()
    ->has('wildcards')) {
    $test['severity'] = ACQUIA_PURGE_SEVLEVEL_WARNING;
    $test['description'] = $t('Your site invalidated one or more paths with' . ' wildcard characters in them in the past, e.g. "news/*". Because of' . ' this, you are now recommended to configure DrupalFakeCache as' . " documented on https://www.drupal.org/node/797346. If you don't do" . ' this, outdated cached copies will be returned from the page cache' . ' for paths you intended to clear with a wildcard.');
  }
  return $test;
}