You are here

function authcache_esi_debug_status_fragment in Authenticated User Page Caching (Authcache) 7.2

Page callback: List test results of manual ESI test.

1 string reference to 'authcache_esi_debug_status_fragment'
authcache_esi_debug_menu in modules/authcache_esi/authcache_esi_debug.module
Implements hook_menu().

File

modules/authcache_esi/authcache_esi_debug.module, line 134
Debug module for Authcache ESI markup generator.

Code

function authcache_esi_debug_status_fragment() {

  // Make sure the installation API is available.
  include_once DRUPAL_ROOT . '/includes/install.inc';
  $requirements['esi-tag'] = array(
    'title' => t('ESI Tag'),
    'value' => t('Tag successfully substituted by reverse proxy.'),
    'severity' => REQUIREMENT_OK,
  );
  $requirements['authcache-request-header'] = array(
    'title' => t('ESI Subrequest Header'),
  );
  if (empty($_SERVER['HTTP_X_AUTHCACHE'])) {
    $requirements['authcache-request-header']['value'] = t('HTTP header %header is not on ESI subrequest.', array(
      '%header' => 'X-Authcache',
    ));
    $requirements['authcache-request-header']['severity'] = REQUIREMENT_ERROR;
    $requirements['authcache-request-header']['description'] = t('Please make sure that the reverse proxy software (varnish) is configured according to the requirements of authcache.');
  }
  else {
    $requirements['authcache-request-header']['value'] = t('HTTP header %header is on ESI subrequest.', array(
      '%header' => 'X-Authcache',
    ));
    $requirements['authcache-request-header']['severity'] = REQUIREMENT_OK;
  }
  $output = theme('status_report', array(
    'requirements' => $requirements,
  ));
  list($otag, $content, $ctag) = _authcache_esi_debug_split_table($output);
  unset($ctag);
  unset($otag);
  drupal_add_http_header('Cache-Control', 'public, max-age=10');
  print $content;
  drupal_exit();
}