From b3f01f207013202cef506968c3e02064d508dfc8 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Tue, 3 Jan 2006 23:38:13 +0000 Subject: [PATCH] check if wgProfiler is defined before checking if it is an object define wfProfileIn/Out only if it was not defined before --- includes/Setup.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/includes/Setup.php b/includes/Setup.php index 75f830f927..d371f625cf 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -24,7 +24,7 @@ if ( !isset( $wgVersion ) ) { if( !isset( $wgProfiling ) ) $wgProfiling = false; -if ( is_object($wgProfiler) ) { +if ( isset($wgProfiler) && is_object($wgProfiler) ) { /* nada, everything should be done already */ } elseif ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) { require_once( 'Profiling.php' ); @@ -37,18 +37,22 @@ if ( is_object($wgProfiler) ) { $wgProfiler = new $prclass(); } } else { - function wfProfileIn( $fn = '' ) { - global $hackwhere, $wgDBname; - $hackwhere[] = $fn; - if (function_exists("setproctitle")) - setproctitle($fn . " [$wgDBname]"); + if (!function_exists('wfProfileIn')) { + function wfProfileIn( $fn = '' ) { + global $hackwhere, $wgDBname; + $hackwhere[] = $fn; + if (function_exists("setproctitle")) + setproctitle($fn . " [$wgDBname]"); + } } - function wfProfileOut( $fn = '' ) { - global $hackwhere, $wgDBname; - if (count($hackwhere)) - array_pop($hackwhere); - if (function_exists("setproctitle") && count($hackwhere)) - setproctitle($hackwhere[count($hackwhere)-1] . " [$wgDBname]"); + if (!function_exists('wfProfileOut')) { + function wfProfileOut( $fn = '' ) { + global $hackwhere, $wgDBname; + if (count($hackwhere)) + array_pop($hackwhere); + if (function_exists("setproctitle") && count($hackwhere)) + setproctitle($hackwhere[count($hackwhere)-1] . " [$wgDBname]"); + } } function wfGetProfilingOutput( $s, $e ) {} function wfProfileClose() {} -- 2.20.1