You are here

function authcache_p13n_exit in Authenticated User Page Caching (Authcache) 7.2

Implements hook_exit().

Related topics

File

modules/authcache_p13n/authcache_p13n.module, line 564
Provides methods for serving personalized content fragments.

Code

function authcache_p13n_exit($destination = NULL) {

  // Invalidate session cache on post requests.
  if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    authcache_p13n_session_invalidate();
  }
  if (authcache_p13n_session_invalidate(TRUE)) {
    module_invoke_all('authcache_p13n_session_invalidate');
  }

  // Log an error if this is called from within frontcontroller with a
  // destination path (due to drupal_goto). Fragments should never redirect.
  if (authcache_p13n_is_authcache_p13n_request()) {
    if ($destination !== NULL) {
      $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
      $caller_frame = _authcache_p13n_get_goto_caller($bt, array(
        __FUNCTION__,
      ));
      if ($caller_frame) {
        $caller_frame += array(
          'class' => '',
          'type' => '',
          'function' => 'unknown',
          'file' => 'unknown',
          'line' => 0,
        );
        $origin = strtr('classtypefunction() called at [file:line]', $caller_frame);
      }
      else {
        $origin = 'unknown';
      }
      watchdog('Authcache P13n Front Controller', 'A redirect was triggered from within a personalization request originating from @origin', array(
        '@origin' => $origin,
      ), WATCHDOG_ERROR);
    }
  }
}