Same name and namespace in other branches
  1. 4.7.x developer/hooks/core.php \hook_exit()
  2. 5.x developer/hooks/core.php \hook_exit()
  3. 6.x developer/hooks/core.php \hook_exit()
  4. 7.x modules/system/system.api.php \hook_exit()

Perform cleanup tasks.

This hook is run at the end of each page request. It is often used for page logging and printing out debugging information.

Only use this hook if your code must run even for cached page views. If you have code which must run once on all non cached pages, use hook_menu(!$may_cache) instead. Thats the usual case. If you implement this hook and see an error like 'Call to undefined function', it is likely that you are depending on the presence of a module which has not been loaded yet. It is not loaded because Drupal is still in bootstrap mode. The usual fix is to move your code to hook_menu(!$may_cache).

Parameters

$destination: If this hook is invoked as part of a drupal_goto() call, then this argument will be a fully-qualified URL that is the destination of the redirect. Modules may use this to react appropriately; for example, nothing should be output in this case, because PHP will then throw a "headers cannot be modified" error when attempting the redirection.

Return value

None.

Related topics

2 functions implement hook_exit()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

statistics_exit in modules/statistics.module
Implementation of hook_exit().
throttle_exit in modules/throttle.module
Implementation of hook_exit().
3 invocations of hook_exit()
drupal_goto in includes/common.inc
Send the user to a different Drupal page.
drupal_page_footer in includes/common.inc
Perform end-of-request tasks.
drupal_page_header in includes/bootstrap.inc
Set HTTP headers in preparation for a page response.

File

developer/hooks/core.php, line 333
These are the hooks that are invoked by the Drupal core.

Code

function hook_exit($destination = NULL) {
  db_query('UPDATE {counter} SET hits = hits + 1 WHERE type = 1');
}