From: Tim Starling Date: Sun, 21 Aug 2005 07:27:29 +0000 (+0000) Subject: profiling X-Git-Tag: 1.6.0~1848 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=3c6a5d961657dc4d2501100113071d13ac587c87;p=lhc%2Fweb%2Fwiklou.git profiling --- diff --git a/includes/Hooks.php b/includes/Hooks.php index 021d799cf0..60dfc41b30 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -33,18 +33,23 @@ if (defined('MEDIAWIKI')) { function wfRunHooks($event, $args) { global $wgHooks; + $fname = 'wfRunHooks'; + wfProfileIn( $fname ); if (!is_array($wgHooks)) { wfDieDebugBacktrace("Global hooks array is not an array!\n"); + wfProfileOut( $fname ); return false; } if (!array_key_exists($event, $wgHooks)) { + wfProfileOut( $fname ); return true; } if (!is_array($wgHooks[$event])) { wfDieDebugBacktrace("Hooks array for event '$event' is not an array!\n"); + wfProfileOut( $fname ); return false; } @@ -101,25 +106,34 @@ if (defined('MEDIAWIKI')) { $hook_args = $args; } - /* Call the hook. */ + if ( $object ) { + $func = get_class( $object ) . '::' . $method; + } + + /* Call the hook. */ + wfProfileIn( $func ); if ($object) { $retval = call_user_func_array(array($object, $method), $hook_args); } else { $retval = call_user_func_array($func, $hook_args); } + wfProfileOut( $func ); /* String return is an error; false return means stop processing. */ if (is_string($retval)) { global $wgOut; $wgOut->fatalError($retval); + wfProfileOut( $fname ); return false; } else if (!$retval) { + wfProfileOut( $fname ); return false; } } + wfProfileOut( $fname ); return true; } } /* if defined(MEDIAWIKI) */