diff options
author | Richard Heyes <richard@php.net> | 2002-04-06 17:01:14 +0000 |
---|---|---|
committer | Richard Heyes <richard@php.net> | 2002-04-06 17:01:14 +0000 |
commit | d3c0d670600550d4d67fc2988ded75caffe6db03 (patch) | |
tree | 5b298247a8e6cd8cd157a7144a11faa10f82d31e | |
parent | 777bc9f9543fb89778b178e650ff6c924304d0c9 (diff) | |
download | php-git-d3c0d670600550d4d67fc2988ded75caffe6db03.tar.gz |
* Added registerShutdownFunc() method
-rw-r--r-- | pear/PEAR.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pear/PEAR.php b/pear/PEAR.php index 98804a1704..2d4edd619c 100644 --- a/pear/PEAR.php +++ b/pear/PEAR.php @@ -40,6 +40,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; $GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; $GLOBALS['_PEAR_destructor_object_list'] = array(); +$GLOBALS['_PEAR_shutdown_funcs'] = array(); $GLOBALS['_PEAR_error_handler_stack'] = array(); /** @@ -173,6 +174,23 @@ class PEAR } // }}} + // {{{ registerShutdownFunc() + + /** + * Use this function to register a shutdown method for static + * classes. + * + * @access public + * @param mixed $func The function name (or array of class/method) to call + * @param mixed $args The arguments to pass to the function + * @return void + */ + function registerShutdownFunc($func, $args = array()) + { + $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); + } + + // }}} // {{{ isError() /** @@ -486,6 +504,13 @@ function _PEAR_call_destructors() // not called more than once. $_PEAR_destructor_object_list = array(); } + + // Now call the shutdown functions + if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) { + foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) { + call_user_func_array($value[0], $value[1]); + } + } } // }}} |