From acdf3bf5c067c02fa331892fdcafd53c1a50aa1c Mon Sep 17 00:00:00 2001 From: marcus Date: Thu, 15 Jan 2009 17:15:50 +0000 Subject: Added shutdown, system event. Refs #672 git-svn-id: https://code.elgg.org/elgg/trunk@2571 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 22e6a22d5..0e333896d 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -2070,6 +2070,16 @@ } + /** + * This function is a shutdown hook registered on startup which does nothing more than trigger a + * shutdown event when the script is shutting down, but before database connections have been dropped etc. + * + */ + function __elgg_shutdown_hook() + { + trigger_elgg_event('shutdown', 'system'); + } + function elgg_init() { // Important actions register_action('comments/add'); @@ -2079,6 +2089,8 @@ add_menu(elgg_echo('content:latest'), $CONFIG->wwwroot . 'dashboard/latest.php'); // Page handler for JS register_page_handler('js','js_page_handler'); + // Register an event triggered at system shutdown + register_shutdown_function('__elgg_shutdown_hook'); } register_elgg_event_handler('init','system','elgg_init'); -- cgit v1.2.3