wiki.techinc.nl/includes/ProfilerStub.php
Alexandre Emsenhuber b8b254da7f Fixes to r62995:
* Avoid fatal error if $wgProfiler is either not a object (ProfilerStub.php) or an instance of Profiler
* Set $wgProfiler to null in ProfilerStub.php so that $wgProfiler doesn't need to be checked with "isset" first, updated check in GlobalFunctions.php accordingly
2010-02-26 08:53:06 +00:00

49 lines
980 B
PHP

<?php
/**
* Stub profiling functions
* @file
* @ingroup Profiler
*/
/** backward compatibility */
$wgProfiling = false;
$wgProfiler = null;
/** is setproctitle function available ? */
$haveProctitle = function_exists( 'setproctitle' );
/**
* Begin profiling of a function
* @param $fn string
*/
function wfProfileIn( $fn = '' ) {
global $hackwhere, $wgDBname, $haveProctitle;
if( $haveProctitle ){
$hackwhere[] = $fn;
setproctitle( $fn . " [$wgDBname]" );
}
}
/**
* Stop profiling of a function
* @param $fn string
*/
function wfProfileOut( $fn = '' ) {
global $hackwhere, $wgDBname, $haveProctitle;
if( !$haveProctitle )
return;
if( count( $hackwhere ) )
array_pop( $hackwhere );
if( count( $hackwhere ) )
setproctitle( $hackwhere[count( $hackwhere )-1] . " [$wgDBname]" );
}
/**
* Does nothing, just for compatibility
*/
function wfGetProfilingOutput( $s, $e ) {}
/**
* Does nothing, just for compatibility
*/
function wfProfileClose() {}