X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHooks.php;h=c726538c9932ce6cb7cd14cdc01b1ad10bcbfc1b;hb=31ba08675466eb1dae5cad7294b527f135c6226d;hp=dffc7bcfe859c7d9f60610b2f7a18ce7b0c92f1b;hpb=96366c1cf1966ca07e8f0b4361bbca28bfaf43a0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Hooks.php b/includes/Hooks.php index dffc7bcfe8..c726538c99 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -135,8 +135,9 @@ class Hooks { * returning null) is equivalent to returning true. */ public static function run( $event, array $args = array(), $deprecatedVersion = null ) { - $profiler = Profiler::instance(); - $eventPS = $profiler->scopedProfileIn( 'hook: ' . $event ); + $stats = RequestContext::getMain()->getStats(); + $metric = $stats->increment( 'hooks.' . $event ); + $metric->setSampleRate( 0.001 ); foreach ( self::getHandlers( $event ) as $hook ) { // Turn non-array values into an array. (Can't use casting because of objects.) @@ -196,8 +197,6 @@ class Hooks { $badhookmsg = null; $hook_args = array_merge( $hook, $args ); - // Profile first in case the Profiler causes errors - $funcPS = $profiler->scopedProfileIn( $func ); set_error_handler( 'Hooks::hookErrorHandler' ); // mark hook as deprecated, if deprecation version is specified @@ -215,7 +214,6 @@ class Hooks { } restore_error_handler(); - $profiler->scopedProfileOut( $funcPS ); // Process the return value. if ( is_string( $retval ) ) {