* 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
global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest;
global $wgProfiler, $wgProfileLimit, $wgUser;
# Profiling must actually be enabled...
- if( !isset( $wgProfiler ) ) return;
+ if( !is_null( $wgProfiler ) ) return;
# Get total page request time
$now = wfTime();
$elapsed = $now - $wgRequestTime;
class Profiler {
var $mStack = array (), $mWorkStack = array (), $mCollated = array ();
var $mCalls = array (), $mTotals = array ();
+ var $mTemplated = false;
function __construct() {
// Push an entry for the pre-profile setup time onto the stack
}
}
+ /**
+ * Mark this call as templated or not
+ * @param $t Boolean
+ */
+ function setTemplated( $t ) {
+ $this->mTemplated = $t;
+ }
+
/**
* called by wfGetProfilingOutput()
*/
class ProfilerSimple extends Profiler {
var $mMinimumTime = 0;
var $mProfileID = false;
- var $mTemplated = false;
function __construct() {
global $wgRequestTime, $wgRUstart;
}
}
- /**
- * Mark this call as templated or not
- * @param boolean $t
- */
- function setTemplated( $t ) {
- $this->mTemplated = $t;
- }
-
function profileIn($functionname) {
global $wgDebugFunctionEntry;
if ($wgDebugFunctionEntry) {
/** backward compatibility */
$wgProfiling = false;
+$wgProfiler = null;
/** is setproctitle function available ? */
$haveProctitle = function_exists( 'setproctitle' );
global $wgArticlePath, $wgScriptPath, $wgServer, $wgProfiler;
wfProfileIn( __METHOD__ );
- $wgProfiler->setTemplated(true);
+ if ( is_object( $wgProfiler ) ) {
+ $wgProfiler->setTemplated( true );
+ }
$oldid = $wgRequest->getVal( 'oldid' );
$diff = $wgRequest->getVal( 'diff' );