From: Domas Mituzas Date: Tue, 10 Jan 2006 00:07:01 +0000 (+0000) Subject: check function_exists() once, do nothing if not exists... X-Git-Tag: 1.6.0~647 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=f97ec5ff1c8fca9d4d7f61f4899de93028b2f097;p=lhc%2Fweb%2Fwiklou.git check function_exists() once, do nothing if not exists... --- diff --git a/includes/ProfilerStub.php b/includes/ProfilerStub.php index 86cc622e1f..edadd5e3d3 100644 --- a/includes/ProfilerStub.php +++ b/includes/ProfilerStub.php @@ -2,17 +2,21 @@ # Stub profiling functions +$haveProctitle=function_exists("setproctitle"); function wfProfileIn( $fn = '' ) { - global $hackwhere, $wgDBname; - $hackwhere[] = $fn; - if (function_exists("setproctitle")) + global $hackwhere, $wgDBname, $haveProctitle; + if ($haveProctitle) { + $hackwhere[] = $fn; setproctitle($fn . " [$wgDBname]"); + } } function wfProfileOut( $fn = '' ) { - global $hackwhere, $wgDBname; - if (count($hackwhere)) + global $hackwhere, $wgDBname, $haveProctitle; + if (!$haveProctitle) + return; + if (count($hackwhere)) array_pop($hackwhere); - if (function_exists("setproctitle") && count($hackwhere)) + if (count($hackwhere)) setproctitle($hackwhere[count($hackwhere)-1] . " [$wgDBname]"); } function wfGetProfilingOutput( $s, $e ) {}