From 2f92fb5bae22b8232ec4d01080db11fc31dcf933 Mon Sep 17 00:00:00 2001 From: ozhozh Date: Wed, 27 Apr 2011 20:52:14 +0000 Subject: [PATCH] Introduce a shutdown hook git-svn-id: http://yourls.googlecode.com/svn/trunk@619 12232710-3e20-11de-b438-597f59cd7555 --- includes/functions.php | 5 +++++ includes/load-yourls.php | 3 +++ 2 files changed, 8 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index 81d971f..7c3cb12 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1841,3 +1841,8 @@ function yourls_fix_request_uri() { } } } + +// Shutdown function, runs just before PHP shuts down execution. Stolen from WP +function yourls_shutdown() { + yourls_do_action( 'shutdown' ); +} \ No newline at end of file diff --git a/includes/load-yourls.php b/includes/load-yourls.php index 2ab1c9b..06d49c5 100644 --- a/includes/load-yourls.php +++ b/includes/load-yourls.php @@ -132,6 +132,9 @@ // Read options right from start yourls_get_all_options(); +// Register shutdown function +register_shutdown_function( 'yourls_shutdown' ); + // Core now loaded yourls_do_action( 'init' ); // plugins can't see this, not loaded yet -- 2.45.0