You are here

function redirect_exit in Redirect 7

Same name and namespace in other branches
  1. 7.2 redirect.module \redirect_exit()

Implements hook_exit().

File

./redirect.module, line 351

Code

function redirect_exit($destination = NULL) {

  // If the current page is being cached, track it.
  if (drupal_get_http_header('Location') && ($rid = drupal_get_http_header('X-Redirect-ID'))) {

    // Ensure the database is loaded. This is only the next bootstrap step
    // after DRUPAL_BOOTSTRAP_DATABASE
    drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
    db_update('redirect')
      ->fields(array(
      'access' => REQUEST_TIME,
    ))
      ->expression('count', 'count + 1')
      ->condition('rid', $rid)
      ->execute();
  }
}