MediaWiki  REL1_19
MWDebug Class Reference

New debugger system that outputs a toolbar on page view. More...

List of all members.

Static Public Member Functions

static addModules (OutputPage $out)
 Add ResourceLoader modules to the OutputPage object if debugging is enabled.
static clearLog ()
 Clears internal log array and deprecation tracking.
static debugMsg ($str)
 This is a method to pass messages from wfDebug to the pretty debugger.
static deprecated ($function, $version, $component)
 Adds a depreciation entry to the log, along with a backtrace.
static getDebugHTML (IContextSource $context)
 Returns the HTML to add to the page for the toolbar.
static getLog ()
 Returns internal log array.
static init ()
 Enabled the debugger and load resource module.
static log ($str)
 Adds a line to the log.
static query ($sql, $function, $isMaster)
 Begins profiling on a database query.
static queryTime ($id)
 Calculates how long a query took.
static warning ($msg, $callerOffset=1)
 Adds a warning entry to the log.

Static Protected Member Functions

static getFilesIncluded (IContextSource $context)
 Returns a list of files included, along with their size.

Static Protected Attributes

static $debug = array()
static $deprecationWarnings = array()
static $enabled = false
static $log = array()
static $query = array()

Detailed Description

New debugger system that outputs a toolbar on page view.

By default, most methods do nothing ( self::$enabled = false ). You have to explicitly call MWDebug::init() to enabled them.

Todo:
Profiler support

Definition at line 11 of file Debug.php.


Member Function Documentation

static MWDebug::addModules ( OutputPage out) [static]

Add ResourceLoader modules to the OutputPage object if debugging is enabled.

Parameters:
$outOutputPage

Definition at line 63 of file Debug.php.

References OutputPage\addModules().

Here is the call graph for this function:

static MWDebug::clearLog ( ) [static]

Clears internal log array and deprecation tracking.

Definition at line 98 of file Debug.php.

Referenced by MWDebugTest\setUp().

Here is the caller graph for this function:

static MWDebug::debugMsg ( str) [static]

This is a method to pass messages from wfDebug to the pretty debugger.

Do NOT use this method, use MWDebug::log or wfDebug()

Parameters:
$strstring

Definition at line 176 of file Debug.php.

Referenced by wfDebug().

Here is the caller graph for this function:

static MWDebug::deprecated ( function,
version,
component 
) [static]

Adds a depreciation entry to the log, along with a backtrace.

Parameters:
$function
$version
$component
Returns:
mixed

Definition at line 140 of file Debug.php.

References $version, Html\element(), Html\rawElement(), wfBacktrace(), and wfGetCaller().

Referenced by MWDebugTest\testAvoidDuplicateDeprecations(), MWDebugTest\testAvoidNonConsecutivesDuplicateDeprecations(), and wfDeprecated().

Here is the call graph for this function:

Here is the caller graph for this function:

static MWDebug::getDebugHTML ( IContextSource context) [static]

Returns the HTML to add to the page for the toolbar.

Parameters:
$contextIContextSource
Returns:
string

Definition at line 249 of file Debug.php.

References $wgRequestTime, $wgVersion, getFilesIncluded(), IContextSource\getLanguage(), IContextSource\getRequest(), Html\inlineScript(), log(), ResourceLoader\makeConfigSetScript(), and ResourceLoader\makeLoaderConditionalScript().

Referenced by Skin\generateDebugHTML().

Here is the call graph for this function:

Here is the caller graph for this function:

static MWDebug::getFilesIncluded ( IContextSource context) [static, protected]

Returns a list of files included, along with their size.

Parameters:
$contextIContextSource
Returns:
array

Definition at line 229 of file Debug.php.

References $file, $files, $size, and IContextSource\getLanguage().

Referenced by getDebugHTML().

Here is the call graph for this function:

Here is the caller graph for this function:

static MWDebug::getLog ( ) [static]

Returns internal log array.

Definition at line 91 of file Debug.php.

References $log.

Referenced by MWDebugTest\testAddLog(), MWDebugTest\testAddWarning(), MWDebugTest\testAvoidDuplicateDeprecations(), and MWDebugTest\testAvoidNonConsecutivesDuplicateDeprecations().

Here is the caller graph for this function:

static MWDebug::init ( ) [static]

Enabled the debugger and load resource module.

This is called by Setup.php when $wgDebugToolbar is true.

Definition at line 53 of file Debug.php.

Referenced by MWDebugTest\setUp().

Here is the caller graph for this function:

static MWDebug::log ( str) [static]

Adds a line to the log.

Todo:
Add support for passing objects
Parameters:
$strstring

Definition at line 76 of file Debug.php.

References wfGetCaller().

Referenced by getDebugHTML(), MWDebugTest\testAddLog(), and MWDebugTest\testAvoidNonConsecutivesDuplicateDeprecations().

Here is the call graph for this function:

Here is the caller graph for this function:

static MWDebug::query ( sql,
function,
isMaster 
) [static]

Begins profiling on a database query.

Parameters:
$sqlstring
$functionstring
$isMasterbool
Returns:
int ID number of the query to pass to queryTime or -1 if the debugger is disabled

Definition at line 193 of file Debug.php.

static MWDebug::queryTime ( id) [static]

Calculates how long a query took.

Parameters:
$idint

Definition at line 214 of file Debug.php.

Referenced by DatabaseBase\query().

Here is the caller graph for this function:

static MWDebug::warning ( msg,
callerOffset = 1 
) [static]

Adds a warning entry to the log.

Parameters:
$msg
int$callerOffset
Returns:
mixed

Definition at line 110 of file Debug.php.

References wfGetCaller().

Referenced by MWDebugTest\testAddWarning(), MWDebugTest\testAvoidNonConsecutivesDuplicateDeprecations(), and wfWarn().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

MWDebug::$debug = array() [static, protected]

Definition at line 25 of file Debug.php.

MWDebug::$deprecationWarnings = array() [static, protected]

Definition at line 47 of file Debug.php.

MWDebug::$enabled = false [static, protected]

Definition at line 39 of file Debug.php.

MWDebug::$log = array() [static, protected]

Definition at line 18 of file Debug.php.

Referenced by getLog().

MWDebug::$query = array() [static, protected]

Definition at line 32 of file Debug.php.


The documentation for this class was generated from the following file: